diff --git a/docs/PROOF-PLACEMENT.adoc b/docs/PROOF-PLACEMENT.adoc new file mode 100644 index 00000000..e453c216 --- /dev/null +++ b/docs/PROOF-PLACEMENT.adoc @@ -0,0 +1,710 @@ +// SPDX-License-Identifier: CC-BY-SA-4.0 += Proof placement by property +:toc: + +This ledger records where each existing engineering proof statement of ECHIDNA +belongs, under owner ruling 2026-11-16 ("split by property"; see the +classification paragraph under R4 in `link:PROOF-STATUS.adoc[PROOF-STATUS]`). + +[cols="1,4",options="header"] +|=== +|Home |Meaning +|`rust` |A property of one shipped Rust function or type. Proved on the Rust with Creusot/Pearlite and Verus (PROOF-POLICY §1.2). The obligation column gives the contract. +|`idris2` |A fact about an interface, ABI, wire format or cross-language encoding. +|`agda-theory` |Holds for any implementation. Stays Agda, rechecked in Rocq and Lean. +|`retire` |Proves nothing about the system: true by definition, an instance of `cong`, a toy counterexample, or a model of behaviour the Rust lacks. The obligation column names its successor, if any. +|=== + +*How this was produced, and what it is not.* For each area, one agent classified every +top-level statement against the source and the Rust. A second agent tried to +refute each verdict. A third reconciled the two against the source. +All three read the source. No canonical check was run and no receipt was +produced: no Lean, Idris 2, Creusot, Verus or cargo, and no pinned Agda run. +One judge rechecked a few Agda probes on a scratch Agda 2.6.3 with the Debian +standard library (named in the R10 open questions); that is evidence for a +verdict, not a receipt. This ledger is a placement, not a receipt. No row +changes a status token in PROOF-STATUS. A `rust` row is an open obligation +until a Creusot run *and* a Verus run discharge it. + +Rows marked as defects in "Model gaps" are source readings. Each needs a +failing test or a repro before it is treated as a confirmed bug. + +== Census + +Each row is one source statement or a named group of closely related +declarations (shown in its name). A statement appears in exactly one area: +where two areas covered the same file, the finer-grained rows were kept and +the duplicates dropped, so a statement has one home. + +[cols="3,1,1,1,1,1",options="header"] +|=== +|Area |Rows |rust |idris2 |agda-theory |retire +|R9: solver integrity (E11) |32 |15 |0 |0 |17 +|R10: ClampTrust |32 |5 |0 |0 |27 +|R4: engineering modules of the meta-checker |73 |25 |2 |20 |26 +|R3: Lean 4 corpus |66 |38 |1 |11 |16 +|Idris 2 verification corpus |30 |9 |1 |0 |20 +|*Total* |*233* |*92* |*4* |*31* |*106* +|=== + +== R9: solver integrity (E11) + +_Files:_ `meta-checker/src/Echidna/Integrity.agda`, `proofs/agda/DispatchOrdering.agda`, `spark/solver_integrity/solver_integrity.ads`, `verification/proofs/lean4/IntegrityVerification.lean` + +[cols="2,3,1,2,4,3",options="header"] +|=== +|Statement |Says |Home |Rust target |Obligation or successor |Why +|`meta-checker/src/Echidna/Integrity.agda:51` + +Hash.≈d-sound (record field, an assumption) |Assumes that when the abstract comparator accepts two digests, the digests are equal. |`retire` |— |none |Models a pluggable comparator the Rust lacks: solver_integrity.rs:277 compares two Strings with ==. Nothing is left to assume once E11-C1 is a contract on that comparison. +|`meta-checker/src/Echidna/Integrity.agda:88` + +decide-verified |If the model helper decide x gives Verified then x is true. |`retire` |— |none |Inversion of a two-clause model helper; true by definition. The Rust has no such function (inline if/else at solver_integrity.rs:277-286). +|`meta-checker/src/Echidna/Integrity.agda:97` + +verified-needs-manifest (E11a) |A Verified result means the manifest held a real digest. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::verify_solver` |E11-C1 (soundness). On a pure core classify(found, expected, computed) that verify_solver calls: ensures(result == Verified ==> found && !is_placeholder(expected) && computed == Some(c) && c == expected), with == the String equality of solver_integrity.rs:277. |One conjunct of the soundness clause of one shipped function. True of the Rust by reading: the placeholder arm (240-264) returns before the comparison. +|`meta-checker/src/Echidna/Integrity.agda:103` + +verified-means-match (E11b) |A Verified result means the recorded digest equals the binary's digest. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::verify_solver` |E11-C1 (soundness). On a pure core classify(found, expected, computed) that verify_solver calls: ensures(result == Verified ==> found && !is_placeholder(expected) && computed == Some(c) && c == expected), with == the String equality of solver_integrity.rs:277. |The headline property of verify_solver. On the Rust it needs no comparator hypothesis. +|`meta-checker/src/Echidna/Integrity.agda:108` + +substituted-never-verified (E11c) |A binary whose digest differs from the recorded one is not Verified. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::verify_solver` |E11-C3 (tamper). On classify: ensures(found && !is_placeholder(expected) && computed == Some(c) && c != expected ==> result == Tampered). |As stated it is the contrapositive of E11b. The Rust gives the exact value Tampered (280-285), so carry that form once. +|`meta-checker/src/Echidna/Integrity.agda:115` + +uninitialised-never-verified (E11d) |An uninitialised manifest never gives Verified (the model returns Missing). |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::verify_solver` |E11-C4 (placeholder). On classify: ensures(found && is_placeholder(expected) ==> result == Uninitialized), for every computed including None. |Property of verify_solver. The Agda value is wrong: the Rust returns Uninitialized for a found binary with a placeholder hash (240-263), Missing only when nothing is found. Carry the exact form. +|`meta-checker/src/Echidna/Integrity.agda:139` + +sharpness |The constant-true comparator on Bool accepts (true, false). |`retire` |— |none |refl on the definition of a toy comparator. +|`meta-checker/src/Echidna/Integrity.agda:143` + +sharpness-matters |true is not equal to false. |`retire` |— |none |Constructor disjointness of Bool; not about the system. +|`meta-checker/src/Echidna/Integrity.agda:148` + +sharpness-blocks-soundness |The constant-true comparator does not satisfy ≈d-sound. |`retire` |— |Successor is a test, not a proof: a mutation test that replaces the comparison at solver_integrity.rs:277 with true and must fail. |Toy counterexample about a comparator parameter the Rust lacks. The file itself claims no check over UnsoundHash. +|`verification/proofs/lean4/IntegrityVerification.lean:92` + +opaque hashShake (declaration, an assumption) |Assumes the SHAKE digest is some pure function of the file bytes. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::compute_shake3_512` |E11-H1. compute_shake3_512: ensures(result == Ok(s) ==> s == hex_encode(shake256_64(bytes read from path))), where shake256_64 is an ASSUMED extern spec on tiny_keccak::Shake (PROOF-POLICY 1.1) and hex_encode gives 128 lower-case hex characters, injective on byte arrays; Err only when the read fails. |Added from review. No classify clause links file bytes to the digest string; this is that link, a property of one shipped function with the hash itself assumed at the crate boundary. +|`verification/proofs/lean4/IntegrityVerification.lean:98` + +opaque hashBlake3 (declaration, an assumption) |Assumes the BLAKE3 digest is some pure function of the file bytes. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::compute_blake3` |E11-H2. compute_blake3: ensures(result == Ok(s) ==> s == hex(blake3(bytes read from path))), where blake3 is an ASSUMED extern spec on the blake3 crate (PROOF-POLICY 1.1); Err only when the read fails. |Added from review. Same reason as hashShake. +|`verification/proofs/lean4/IntegrityVerification.lean:176` + +verify_sound (PI-1) |A verified result means the file was found, the manifest holds a real digest, and the computed digest equals it. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::verify_solver` |E11-C1 (soundness). On a pure core classify(found, expected, computed) that verify_solver calls: ensures(result == Verified ==> found && !is_placeholder(expected) && computed == Some(c) && c == expected), with == the String equality of solver_integrity.rs:277. |The complete soundness statement; its three conjuncts match the three early returns. Same fact as E11a and E11b together. +|`verification/proofs/lean4/IntegrityVerification.lean:195` + +verify_complete (PI-2) |If the file is found and its digest equals the manifest digest, the result is verified. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::verify_solver` |E11-C2 (completeness). On classify: ensures(found && !is_placeholder(expected) && computed == Some(c) && c == expected ==> result == Verified), over the hex strings compared, not over bytes. |Property of verify_solver. On the Rust it holds only for string-identical hex: an upper-case or padded manifest digest gives Tampered. +|`verification/proofs/lean4/IntegrityVerification.lean:213` + +verify_tamper_detection (PI-3) |If the binary's digest differs from the manifest digest, the result is not verified. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::verify_solver` |E11-C3 (tamper). On classify: ensures(found && !is_placeholder(expected) && computed == Some(c) && c != expected ==> result == Tampered). |Same fact as E11c. Its docstring claims a content-level, collision-conditional result; the hypothesis is only a digest difference. +|`verification/proofs/lean4/IntegrityVerification.lean:229` + +verify_exhaustive (PI-4) |The model verifier returns one of the four constructors of its four-constructor type. |`retire` |— |Successor: ensures(result != Unchecked) on classify, which follows from E11-CT (the total table) and is already stated at spark/solver_integrity/solver_integrity.ads:76. |Verdict changed by review. True of any function into that type, because the model drops the fifth Rust variant. 'Never Unchecked' is a new statement, not this one moved. +|`verification/proofs/lean4/IntegrityVerification.lean:249` + +verify_placeholder (PI-5) |A found binary with a placeholder manifest entry gives uninitialized, whatever its content. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::verify_solver` |E11-C4 (placeholder). On classify: ensures(found && is_placeholder(expected) ==> result == Uninitialized), for every computed including None. |Matches the Rust (240-263), which returns Uninitialized even when hashing the found file fails. +|`verification/proofs/lean4/IntegrityVerification.lean:257` + +verify_missing (PI-6) |A file that is not found gives missing, whatever the manifest entry. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::verify_solver` |E11-C5 (missing). On classify: ensures(!found ==> result == Missing) and ensures(found && !is_placeholder(expected) && computed == None ==> result == Missing). |First early return (220-237). The Rust has a second Missing path (found but unreadable, 298-309) the Lean lacks; state both. +|`verification/proofs/lean4/IntegrityVerification.lean:279` + +CollisionResistantShake (assumption class) |Assumes hashShake is injective on byte strings. |`retire` |— |Successor: an ASSUMED boundary row (PROOF-POLICY 1.1) saying collision resistance of SHAKE-256/512 (tiny-keccak) and BLAKE3 (blake3 crate) is a computational assumption, recorded as an assumption and not stated as injectivity. |Injectivity is false of a 64-byte digest over unbounded input. The Lean hides it because Digest512 is an unbounded list. Already noted in PROOF-STATUS.adoc:284-287. +|`verification/proofs/lean4/IntegrityVerification.lean:285` + +verify_tamper_detected_under_cr (PI-7) |If hashShake is injective, a binary with different content is not verified. |`retire` |— |Successor: an ASSUMED boundary row (PROOF-POLICY 1.1) saying collision resistance of SHAKE-256/512 (tiny-keccak) and BLAKE3 (blake3 crate) is a computational assumption, recorded as an assumption and not stated as injectivity. |Rests on a hypothesis the real hash cannot meet. Its digest-level content is already E11-C3. +|`verification/proofs/lean4/IntegrityVerification.lean:313` + +cacheInvariant (PI-8, a definition) |Defines: the cached BLAKE3 is the BLAKE3 of the bytes current at the last successful full verification. |`retire` |— |Successor (E11-K), to be stated after the owner decides what the cache should hold: verify_solver writes blake3_cache[name] only in the placeholder arm and the SHAKE-ok arm (solver_integrity.rs:250-253, 272-275) and only when the BLAKE3 read succeeds; every other key, and both Missing arms, leave the cache unchanged. |Verdict changed by review. A definition, not a theorem, over a last_verified_bs field and a 'successful verification' event the Rust does not keep. The colleague's sketched ensures is false in the SHAKE-read-fails arm (298-309), where nothing is written. +|`verification/proofs/lean4/IntegrityVerification.lean:328` + +CollisionResistantBlake3 (assumption class) |Assumes hashBlake3 is injective on byte strings. |`retire` |— |Successor: an ASSUMED boundary row (PROOF-POLICY 1.1) saying collision resistance of SHAKE-256/512 (tiny-keccak) and BLAKE3 (blake3 crate) is a computational assumption, recorded as an assumption and not stated as injectivity. |False of a 32-byte digest by counting, as for the SHAKE class. +|`verification/proofs/lean4/IntegrityVerification.lean:331` + +quickReverify_sound_under_cr (PI-9) |If the cache invariant holds and BLAKE3 is injective, an accepting quick re-verify means the content is unchanged. |`retire` |— |Successor (E11-Q), only if quick_reverify gets a caller: Ok(b) ==> the cache held an entry for the name at entry and b == (hex BLAKE3 of the file found now == that entry); Err on no cache entry, unknown solver, binary not found, or read failure. |Verdict changed by review. Its only real step is the injectivity class retired above, as for PI-7. The sketched core contract result == (current == cached) is the meaning of ==. quick_reverify (solver_integrity.rs:315) has no caller; it has four Err paths, not three. +|`verification/proofs/lean4/IntegrityVerification.lean:347` + +quickReverify_complete (PI-10) |If the content is unchanged and the cache invariant holds, quick re-verify accepts. |`retire` |— |none |An instance of congruence: equal inputs to any function give equal outputs. Holds with any function in place of hashBlake3. +|`verification/proofs/lean4/IntegrityVerification.lean:369` + +trust_gate_iff_verified (PI-11) |The model's solver_integrity_ok is true exactly when the status is verified. |`rust` |`src/rust/dispatch.rs::verify_proof, verify_proof_cross_checked, verify_proof_parallel (one gate function to extract)` |E11-G. On one extracted dispatch gate integrity_gate(checker_present, reports, prover_kind) -> bool that includes the name lookup: (a) ensures(the first report whose lower-cased name matches has status Tampered or Missing ==> !result), which holds of today's code; (b) ensures(result ==> a matching report exists with status Verified), which is OPEN and fails today (Uninitialized accepted, no match gives true, no checker gives true). Owner decision D9 says whether the code or clause (b) changes. |Verdict changed by review (colleague: retire). The Lean proof is by definition, but the property is about a gate the Rust has, at dispatch.rs:648-661, and breaks. Retiring it while keeping PI-12 would leave only the half the code passes. Listed in unresolved because it turns on D9. +|`verification/proofs/lean4/IntegrityVerification.lean:377` + +tampered_kills_trust (PI-12) |The model's solver_integrity_ok is false for a tampered status. |`rust` |`src/rust/dispatch.rs::verify_proof, verify_proof_cross_checked, verify_proof_parallel (one gate function to extract)` |E11-G. On one extracted dispatch gate integrity_gate(checker_present, reports, prover_kind) -> bool that includes the name lookup: (a) ensures(the first report whose lower-cased name matches has status Tampered or Missing ==> !result), which holds of today's code; (b) ensures(result ==> a matching report exists with status Verified), which is OPEN and fails today (Uninitialized accepted, no match gives true, no checker gives true). Owner decision D9 says whether the code or clause (b) changes. |Home kept; contract corrected by review. With the lookup left outside, the clause is true by definition. The lookup is where a Tampered status is lost: manifest keys lean4 and hol_light never match a ProverKind name. Composes with crates/echidna-core-creusot/src/lib.rs:334. +|`spark/solver_integrity/solver_integrity.ads:57` + +Classify_Verification postcondition |Gives the full decision table of verify_solver over four Booleans: Verified, Tampered, Uninitialized, two Missing paths, never Unchecked. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::verify_solver` |E11-CT (total table). On classify: E11-C1, C2, C3, C4 and C5 together, plus ensures(result != Unchecked); and verify_solver's report.status equals classify of what it observed. |Added from review. The table is a property of the Rust function; the Ada mirror is not called by the Rust and SPARK is not the Rust verifier (PROOF-POLICY 1). Use it as the starting text for the Rust contract. No gnatprove receipt (ledger R12). +|`spark/solver_integrity/solver_integrity.ads:84` + +Is_Safe (expression function) |Defines safe as Verified, Uninitialized or Unchecked, mirroring is_solver_safe. |`retire` |— |Successor: clause (b) of E11-G, one accepted-status set for the dispatch gate after owner decision D9. |Added from review. A definition; is_solver_safe (solver_integrity.rs:355-361) has no caller and accepts a different set from the dispatch gate. +|`spark/solver_integrity/solver_integrity.ads:92` + +Quick_Reverify postcondition |The outcome is Unchanged exactly when the Boolean input Cached_Match is true. |`retire` |— |Successor (E11-Q), only if quick_reverify gets a caller: Ok(b) ==> the cache held an entry for the name at entry and b == (hex BLAKE3 of the file found now == that entry); Err on no cache entry, unknown solver, binary not found, or read failure. |Added from review. True by definition of a two-branch function on one Boolean. +|`spark/solver_integrity/solver_integrity.ads:107` + +Aggregate_Safe (expression function) |Defines a set of solvers as safe when every member is safe. |`retire` |— |none |Added from review. The Rust has no aggregate decision: verify_all only counts and logs (solver_integrity.rs:179-206) and dispatch reads one report. +|`spark/solver_integrity/solver_integrity.ads:126` + +Cap_At_Tampered (ghost lemma, with Has_Tampered at :113) |If any member is Tampered, the set is not safe. |`retire` |— |none |Added from review. About the aggregate predicate the Rust does not have. +|`spark/solver_integrity/solver_integrity.ads:134` + +Hash_Mismatch_Means_Tampered (ghost lemma) |Found, real hash, hash computed and no match gives Tampered. |`rust` |`src/rust/integrity/solver_integrity.rs::IntegrityChecker::verify_solver` |E11-C3 (tamper). On classify: ensures(found && !is_placeholder(expected) && computed == Some(c) && c != expected ==> result == Tampered). |Added from review. The reviewer proposed retire as a restatement inside one file; kept as rust because it is the same fact as E11c and PI-3, which stay rust, so the three group under one clause. No separate lemma is needed on the Rust. +|`proofs/agda/DispatchOrdering.agda:81` + +integrity-before-sandbox, -verify, -certs, -axioms, -confidence, integrity-precedes (6, lines 81-104) |Stage number 0, named Integrity, is less than every other stage number. |`retire` |— |Successor (E11-O), after a code change: in src/rust/dispatch.rs the integrity verdict is computed before the prover runs. Today it is Step 6 at dispatch.rs:647, after the prover run at :611. |Added from review. Arithmetic on literal stage numbers, and the order is not the Rust order. No other area's classification lists this file. +|=== + +=== Model gaps + +* Agda check maps an uninitialised manifest to Missing (meta-checker/src/Echidna/Integrity.agda:81). The Rust returns Uninitialized for a found binary with a placeholder hash (src/rust/integrity/solver_integrity.rs:240-263) and Missing only when no binary is found (:220-237). +* Agda takes the digest comparison as a parameter with an assumed soundness field (Integrity.agda:47-51). The Rust has one fixed comparison, String == (solver_integrity.rs:277). The Agda has no file, no hash function and a three-constructor result (Integrity.agda:64-67); the Rust enum has five variants. +* Lean omits Unchecked (verification/proofs/lean4/IntegrityVerification.lean:128-132). The Rust get_status returns it (solver_integrity.rs:351) and is_solver_safe accepts it (:359). This is what makes verify_exhaustive (lean:229) vacuous. +* Lean FileResult is found-with-bytes or notFound (IntegrityVerification.lean:136-138). The Rust has a third case, found but unreadable: with a placeholder hash it still returns Uninitialized with both hashes None (solver_integrity.rs:246-263); with a real hash it returns Missing (:298-309). +* Lean ManifestHash is a typed sum (IntegrityVerification.lean:111-113). The Rust holds a String, tests starts_with("PLACEHOLDER") (solver_integrity.rs:240) and compares hex with String equality (:277). An upper-case, padded or truncated manifest digest gives Tampered, so verify_complete (lean:195) does not hold of the Rust for digests equal as bytes but not as strings. +* Lean cacheInvariant says the cache holds the BLAKE3 of the bytes at the last successful full verification (IntegrityVerification.lean:302-314). The Rust writes the cache in the placeholder arm (solver_integrity.rs:250-253) and before the comparison (:272-275), so also on Tampered; the BLAKE3 comes from a second file read (:125) separate from the SHAKE read (:111); nothing is written in the SHAKE-read-fails arm (:298-309); a stale entry survives a later Missing result. +* Lean quickReverify is a total Bool over given bytes (IntegrityVerification.lean:321-322). The Rust quick_reverify re-resolves the path (solver_integrity.rs:329), so it may hash a different file; it has four Err paths (:319, :327, :330, :332); the cache lock is dropped at :321 before hashing, so Ok(true) relates to the value read at entry. +* Lean integrityToBool is 'status = verified' (IntegrityVerification.lean:364-365). The Rust gate (src/rust/dispatch.rs:648-661, 858-871, 1009-1022) accepts Verified or Uninitialized (:655-656), gives true when no report name matches (:658) and true when no checker is attached (:660). trust_gate_iff_verified (lean:369) is false of the Rust. +* The fourth fail-open path in the ledger (docs/PROOF-STATUS.adoc:181-184, 'a verify_all() error read as an empty report') is unreachable: verify_all has no error path and its only return is Ok(results) (solver_integrity.rs:164-209, :208). The unwrap_or_default at dispatch.rs:649 is dead. Three fail-open paths are reachable, not four. +* The gate matches reports by format!("{:?}", prover_kind).to_lowercase() (dispatch.rs:650-653). Manifest keys lean4 (config/solver-manifest.toml:18) and hol_light (:48) never match ProverKind::Lean or ProverKind::HOLLight (crates/echidna-core/src/prover_kind.rs:27, :34), so a Tampered report for those two still gives true. ProverKind::MizAR (prover_kind.rs:324) lower-cases to 'mizar' and reads the Mizar entry's report (solver-manifest.toml:54). find takes the first match. Read from source, not exercised. No proof file states this name mapping. +* Collision resistance is modelled as injectivity (IntegrityVerification.lean:279-280, 328-329). That is false of any fixed-length digest over unbounded input; the Lean digest types are unbounded lists (lean:73-75, 78-80), which hides it. PI-7 and PI-9 rest on it. +* SPARK Aggregate_Safe and Cap_At_Tampered (spark/solver_integrity/solver_integrity.ads:107-108, 126-129) model a fleet-level decision. The Rust has none: verify_all counts and logs (solver_integrity.rs:179-206) and dispatch reads one report (dispatch.rs:651-653). +* SPARK Is_Safe (solver_integrity.ads:84-85) mirrors is_solver_safe (solver_integrity.rs:355-361), which has no caller and accepts Unchecked; the dispatch gate (dispatch.rs:655-656) uses a different set. Two 'safe' predicates exist in the Rust. +* DispatchOrdering models Integrity as stage 0, before every other stage (proofs/agda/DispatchOrdering.agda:34-35, 81-104; verification/proofs/idris2/DispatchOrdering.idr:15, 23, 41). The Rust runs the integrity check as Step 6 (dispatch.rs:647), after the prover run at Step 3 (:611). +* None of the modelled code runs in the shipped binary: with_integrity_checker (dispatch.rs:317) has no caller, and all 17 entries of config/solver-manifest.toml hold PLACEHOLDER_COMPUTE_ON_FIRST_RUN, so solver_integrity_ok is always true at run time. quick_reverify (solver_integrity.rs:315) and is_solver_safe (:355) have no caller. Contracts on verify_solver do not close DEBT D9. +* verify_solver (solver_integrity.rs:212) is async, takes a tokio RwLock, reads the filesystem and spawns `which` (:147), so the rust rows assume a pure core is extracted and called by the shipped function. The existing core, SPARK Classify_Verification (spark/solver_integrity/solver_integrity.adb:22-49), is an Ada mirror the Rust does not call and has no gnatprove receipt (docs/PROOF-STATUS.adoc:299-309). +* Evidence note, not a model gap: no Rust test reaches a found binary in verify_solver. The verify_all tests give Missing or an empty manifest (solver_integrity.rs:458-493) and test_tampered_binary_detected (:434-450) compares two BLAKE3 hashes without calling the verifier. The Verified, Tampered and Uninitialized arms (:240-297) are untested. +* Documentation overclaim: src/rust/integrity/mod.rs:5-8 says a mismatched solver 'will not be used'. The code only lowers the trust level, and only if a checker is attached, which never happens. + +=== Open questions + +* PI-11 trust_gate_iff_verified (IntegrityVerification.lean:369). Reading A (reviewer, adopted here): home rust, kept as an open obligation on the dispatch gate that today's code fails, so the finding stays visible beside PI-12. Reading B (colleague): retire, because the Lean theorem is true by definition and models a Verified-only gate the Rust lacks, with a successor written after D9. The facts are agreed; the choice turns on the owner's D9 decision about which statuses the gate may accept (Uninitialized, no manifest entry, no checker). +* PI-8 cacheInvariant and the cache-write successor E11-K. The source does not say what the BLAKE3 cache is meant to hold. Reading A: the bytes at the last successful (Verified) check, as the Lean says, in which case the Rust is wrong to refresh it on Tampered and Uninitialized (solver_integrity.rs:250-253, 272-275). Reading B: the bytes at the last check that hashed the file, which is what the Rust does. Owner decision needed before a contract is written. +* MetaChecker aliases key-integrity-1 and key-integrity-2 (MetaChecker.agda:148-149). Reading A (reviewer): same home as their targets, rust. Reading B (used here, and matching the R4 area's single row that retires all the key-* aliases): retire the alias, with the target's obligation as successor. The obligation text is identical either way, so the doc groups them with E11b and E11d. +* Whether the classify clauses are written over hex Strings (as the Rust compares today) or over decoded bytes. Not checked: whether current Creusot or Verus can specify String ==, starts_with and format!. Decoding the manifest digest to bytes at load would remove the string-equality gap in E11-C2 and create an encoding fact for Idris 2 (128 lower-case hex characters or the placeholder sentinel). No such statement exists today, so there is no idris2 row; this is a design choice for the owner. +* The ProverKind-to-manifest-key mapping (Debug name lower-cased against TOML keys) is a cross-format fact that no proof file states and that fails for lean4 and hol_light and collides for MizAR and Mizar. It would be an idris2 obligation if stated, or it disappears if the gate looks reports up by a typed key. Not settled from source; read, not exercised. + +== R10: ClampTrust + +_Files:_ `meta-checker/src/Echidna/ClampTrust.agda`, `verification/proofs/idris2/ClampTrustBounds.idr`, `verification/proofs/idris2/NatLte.idr` + +[cols="2,3,1,2,4,3",options="header"] +|=== +|Statement |Says |Home |Rust target |Obligation or successor |Why +|`meta-checker/src/Echidna/ClampTrust.agda:50` + +clamp-trust (definition, the model) |Defines a one-argument map from naturals to levels: 0 and 1 give Level1, 2 to 4 give Level2 to Level4, 5 and above give Level5. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |No Rust function has this shape: clamp_trust takes three levels (lib.rs:282) and no integer-to-TrustLevel conversion exists in src/ or crates/. It models behaviour the Rust lacks. +|`meta-checker/src/Echidna/ClampTrust.agda:62` + +clamp-lower |For every natural n, the numeric value of clamp-trust n is at least 1. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::value` |TrustLevel::value: ensures(1u8 <= result && result <= 5u8), already written at crates/echidna-core-creusot/src/lib.rs:127 and never discharged; strengthen to the exact code (Level1..Level5 give 1..5), which implies the range. No requires. Discharge in Creusot (Pearlite) and in Verus. One clause for every row that carries this text; shared with the TrustLevel area (R3/R4). |The bound holds for every level, so the clamp plays no part (reviewer's probe rechecked here, exit 0). Reviewer asked for retire-as-instance; kept rust because the content is exactly the written contract on a function shipped code calls (src/rust/verification/pareto.rs:76, :115), and the shared obligation text makes it one clause. +|`meta-checker/src/Echidna/ClampTrust.agda:70` + +clamp-upper |For every natural n, the numeric value of clamp-trust n is at most 5. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::value` |TrustLevel::value: ensures(1u8 <= result && result <= 5u8), already written at crates/echidna-core-creusot/src/lib.rs:127 and never discharged; strengthen to the exact code (Level1..Level5 give 1..5), which implies the range. No requires. Discharge in Creusot (Pearlite) and in Verus. One clause for every row that carries this text; shared with the TrustLevel area (R3/R4). |Same as clamp-lower: it is 'every level has value at most 5', independent of the clamp. Kept rust against the reviewer's retire-as-instance for the same reason. +|`meta-checker/src/Echidna/ClampTrust.agda:88` + +clamp-step |clamp-trust n is at most clamp-trust (suc n) in the trust order. |`retire` |— |none |Helper for clamp-monotone over the natural-number domain, which the Rust clamp does not have. +|`meta-checker/src/Echidna/ClampTrust.agda:97` + +≤-difference |If n ≤ m then m = k + n for some k. |`retire` |— |none |Generic arithmetic that restates a standard-library lemma (≤⇒≤″); it says nothing about echidna and exists only to feed clamp-monotone. +|`meta-checker/src/Echidna/ClampTrust.agda:99` + +≤-difference-step |If b = k + a then suc b = k + suc a. |`retire` |— |none |Arithmetic helper for ≤-difference; nothing about the system. +|`meta-checker/src/Echidna/ClampTrust.agda:107` + +clamp-chain |clamp-trust n is at most clamp-trust (k + n) for every k. |`retire` |— |none |Helper for clamp-monotone in the natural-number domain; no Rust counterpart. +|`meta-checker/src/Echidna/ClampTrust.agda:111` + +clamp-monotone |If n ≤ m as naturals then clamp-trust n is at most clamp-trust m in the trust order. |`retire` |— |Successor (new, only if the owner keeps clamp_trust): on crates/echidna-core-creusot/src/lib.rs::clamp_trust, requires(min_level <= max_level); ensures(min_level <= result && result <= max_level) (written at lib.rs:278-281, never discharged); add ensures(level < min_level ==> result == min_level), ensures(level > max_level ==> result == max_level), ensures(min_level <= level && level <= max_level ==> result == level). Monotonicity in level and idempotence follow from these three. Creusot (Pearlite) and Verus. If the function is deleted: none. |Verdict changed from rust on review. It is a theorem about the retired natural-number model; at the range [Level1, Level5] the Rust clamp is the identity, so nothing carries. The level-to-level statement is new, and its target has no caller (only lib.rs:282 and its test at :580-592). +|`meta-checker/src/Echidna/ClampTrust.agda:121` + +clamp-fixed-1 |clamp-trust 1 = Level1. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Holds by refl: a defining clause of the model read back. Same proposition as Idris clamp_fp_1 and clamp_surjective_L1, so all three now carry one verdict. +|`meta-checker/src/Echidna/ClampTrust.agda:124` + +clamp-fixed-0 |clamp-trust 0 = Level1. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Holds by refl. It fixes how code 0 is read, which the Rust never decides. Per the review, the policy for 0 is recorded in the successor and left to the owner, not settled as 'reject'. +|`meta-checker/src/Echidna/ClampTrust.agda:127` + +clamp-fixed-5 |clamp-trust 5 = Level5. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Holds by refl; same proposition as Idris clamp_fp_5 and clamp_surjective_L5. +|`meta-checker/src/Echidna/ClampTrust.agda:130` + +clamp-fixed-10 |clamp-trust 10 = Level5. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Holds by refl. It models upward saturation of an out-of-range code, which the Rust does not do and which would fail open. +|`meta-checker/src/Echidna/ClampTrust.agda:135` + +clamp-above |Every natural of the form 5 + k clamps to Level5. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Holds by refl (the last defining clause). It is the model's policy for codes above 5: maximum trust. The Rust has no such decode; do not carry it forward. +|`meta-checker/src/Echidna/ClampTrust.agda:147` + +clamp-idempotent |Clamping the numeric value of clamp-trust n again gives a level with the same numeric value. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Verdict changed from rust on review. It is cong applied to the round trip clamp-trust (trust-to-ℕ t) ≡ t (rechecked, exit 0), and a constant map satisfies the same shape. Idempotence of the Rust clamp is a new statement, covered by the clamp_trust successor under clamp-monotone. +|`verification/proofs/idris2/ClampTrustBounds.idr:37` + +TrustLevel, trustValue, TrustLTE, clamp_trust (definitions at :37, :46, :59, :78) |Defines a local five-level type, its value 1..5, an order by value, and the same one-argument clamp as the Agda module. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |A third local copy of the level type, tied neither to the ABI type (six constructors, src/abi/EchidnaABI/Types.idr:385) nor to the Rust. Its docstring (:76) claims Rust semantics that no Rust function has. +|`verification/proofs/idris2/ClampTrustBounds.idr:95` + +clamp_lower_bound |For every n, trustValue (clamp_trust n) is at least 1. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::value` |TrustLevel::value: ensures(1u8 <= result && result <= 5u8), already written at crates/echidna-core-creusot/src/lib.rs:127 and never discharged; strengthen to the exact code (Level1..Level5 give 1..5), which implies the range. No requires. Discharge in Creusot (Pearlite) and in Verus. One clause for every row that carries this text; shared with the TrustLevel area (R3/R4). |Duplicate of Agda clamp-lower; the property is the range of value(). The Idris copy goes once the Rust contract has a receipt. +|`verification/proofs/idris2/ClampTrustBounds.idr:112` + +clamp_upper_bound |For every n, trustValue (clamp_trust n) is at most 5. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::value` |TrustLevel::value: ensures(1u8 <= result && result <= 5u8), already written at crates/echidna-core-creusot/src/lib.rs:127 and never discharged; strengthen to the exact code (Level1..Level5 give 1..5), which implies the range. No requires. Discharge in Creusot (Pearlite) and in Verus. One clause for every row that carries this text; shared with the TrustLevel area (R3/R4). |Duplicate of Agda clamp-upper; same destination. +|`verification/proofs/idris2/ClampTrustBounds.idr:139` + +ClampZone, classifyNat (:139, :148) |Every natural falls in one of five zones: at most 1, exactly 2, 3 or 4, or at least 5. |`retire` |— |none |Unused: the clamp_monotone docstring (:225) names classifyNat but the proof never mentions it. A partition of the naturals says nothing about the Rust. +|`verification/proofs/idris2/ClampTrustBounds.idr:157` + +clampZone01 |If n ≤ 1 then clamp_trust n = Level1. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Reads back the first two defining clauses and is used by no other proof. Its reading of code 0 goes to the owner with the successor, as for Agda clamp-fixed-0. +|`verification/proofs/idris2/ClampTrustBounds.idr:163` + +clampZone5up |If 5 ≤ n then clamp_trust n = Level5. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Reads back the last defining clause; unused. Same fail-open reading of codes above 5 as Agda clamp-above. +|`verification/proofs/idris2/ClampTrustBounds.idr:178` + +l1lteL1 .. l5lteL5 (15 lemmas, lines 178-221) |For each pair of levels i ≤ j, the literal comparison of their values holds. |`retire` |— |Successor (TrustLevel area R3/R4, Rust): on TrustLevel, the derived Ord agrees with the code order: forall a b, (a <= b) == (a.value() <= b.value()). Creusot (Pearlite) and Verus. |TrustLTE is defined as the order on values (:60), so each lemma is a closed fact about two number literals: true by definition. Reviewer asked for the same treatment as the bounds; kept retire because the bounds relate value() to 1 and 5, while these relate nothing to the Rust order. The Rust fact is named as successor. +|`verification/proofs/idris2/ClampTrustBounds.idr:231` + +clamp_monotone |If n ≤ m as naturals then the value of clamp_trust n is at most the value of clamp_trust m. |`retire` |— |Successor (new, only if the owner keeps clamp_trust): on crates/echidna-core-creusot/src/lib.rs::clamp_trust, requires(min_level <= max_level); ensures(min_level <= result && result <= max_level) (written at lib.rs:278-281, never discharged); add ensures(level < min_level ==> result == min_level), ensures(level > max_level ==> result == max_level), ensures(min_level <= level && level <= max_level ==> result == level). Monotonicity in level and idempotence follow from these three. Creusot (Pearlite) and Verus. If the function is deleted: none. |Verdict changed from rust on review. Duplicate of Agda clamp-monotone, built only from the retired model and the retired literal table. +|`verification/proofs/idris2/ClampTrustBounds.idr:291` + +clamp_fp_1 |clamp_trust 1 = Level1. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Refl on a defining clause; identical to clamp_surjective_L1 (:315) and Agda clamp-fixed-1. +|`verification/proofs/idris2/ClampTrustBounds.idr:296` + +clamp_fp_5 |clamp_trust 5 = Level5. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Refl on a defining clause; identical to clamp_surjective_L5 (:331) and Agda clamp-fixed-5. +|`verification/proofs/idris2/ClampTrustBounds.idr:301` + +clamp_fp_10 |clamp_trust 10 = Level5. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Refl on a defining clause; models upward saturation the Rust does not do. Same as Agda clamp-fixed-10. +|`verification/proofs/idris2/ClampTrustBounds.idr:310` + +clamp_in_range |For every n, the value of clamp_trust n is between 1 and 5. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::value` |TrustLevel::value: ensures(1u8 <= result && result <= 5u8), already written at crates/echidna-core-creusot/src/lib.rs:127 and never discharged; strengthen to the exact code (Level1..Level5 give 1..5), which implies the range. No requires. Discharge in Creusot (Pearlite) and in Verus. One clause for every row that carries this text; shared with the TrustLevel area (R3/R4). |The pair of the two bounds; it is exactly the clause already written on value(). +|`verification/proofs/idris2/ClampTrustBounds.idr:315` + +clamp_surjective_L1 |clamp_trust 1 = Level1. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Verdict changed from idris2 on review. Word for word clamp_fp_1 (:291), which was retired; one proposition gets one verdict. The interface fact it points at has no implementation yet and is recorded once as the successor. +|`verification/proofs/idris2/ClampTrustBounds.idr:319` + +clamp_surjective_L2 |clamp_trust 2 = Level2. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Verdict changed from idris2 on review. Refl on a defining clause of a decoder no interface has; the comment at :313 says surjectivity, which the line does not state. +|`verification/proofs/idris2/ClampTrustBounds.idr:323` + +clamp_surjective_L3 |clamp_trust 3 = Level3. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Verdict changed from idris2 on review, as for clamp_surjective_L2. +|`verification/proofs/idris2/ClampTrustBounds.idr:327` + +clamp_surjective_L4 |clamp_trust 4 = Level4. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Verdict changed from idris2 on review, as for clamp_surjective_L2. +|`verification/proofs/idris2/ClampTrustBounds.idr:331` + +clamp_surjective_L5 |clamp_trust 5 = Level5. |`retire` |— |Successor (new, Idris2 ABI package, blocked on the owner ruling on trust code 0): the numeric trust code is injective on the ABI TrustLevel, its image is exactly the declared codes, a decoder returns the level whose code it was given, and a code outside the image is rejected, never saturated upward. The Rust half is the exact-code ensures on TrustLevel::value. |Verdict changed from idris2 on review. Word for word clamp_fp_5 (:296). +|`verification/proofs/idris2/NatLte.idr:33` + +lteLit (with its helper fromYes at :26) |For two number literals m and n with m ≤ n, it returns the proof of m ≤ n by running the library decision procedure. |`retire` |— |none; remove only when no Idris2 module imports NatLte (ProverKindInjectivity.idr:17 still does) |Listed by the reviewer; exists. Generic proof tooling that says nothing about the system. Every R10 use of it sits in rows that retire or move to Rust, so R10 gives it no reason to stay. +|=== + +=== Model gaps + +* Signature: both proofs model a one-argument map Nat -> TrustLevel with the range fixed at [Level1, Level5] (meta-checker/src/Echidna/ClampTrust.agda:50; verification/proofs/idris2/ClampTrustBounds.idr:78). The Rust is clamp_trust(level, min_level, max_level), all TrustLevel, with precondition min_level <= max_level (crates/echidna-core-creusot/src/lib.rs:278-290). Nothing in the proofs matches the two range arguments or the precondition, and at [Level1, Level5] the Rust clamp is the identity. +* The Rust clamp_trust has no caller: grep over echidna and its sibling estate checkouts finds only the definition (crates/echidna-core-creusot/src/lib.rs:282) and its own test PO-7 (:580-592). Under its precondition it returns what the derived Ord::clamp returns (TrustLevel derives Ord at lib.rs:91-93). +* No integer-to-level conversion exists in shipped Rust (no From, TryFrom or from_u8 for TrustLevel in src/ or crates/). The Cap'n Proto UInt8 fields have no Rust reader (crates/echidna-wire/schemas/proof.capnp:15, :27; prover.capnp:46; schemas/echidna.capnp:32; the only trust call is set_trust_level(3) in a test, crates/echidna-wire/src/lib.rs:91). So the model's decode of 0 to Level1 (ClampTrust.agda:51, :124; ClampTrustBounds.idr:79, :157) and of 5 and above to Level5 (ClampTrust.agda:56, :130, :135; ClampTrustBounds.idr:84, :163, :301) describes nothing. +* Correction to the first pass ('the Rust has no decoder at all'): the only decoder is the derived serde::Deserialize (crates/echidna-core-creusot/src/lib.rs:91-93), used by DispatchResult and DispatchConfig (src/rust/dispatch.rs:65-70, :109-114; decode test :1293-1296). It reads the name "LevelN" and rejects anything else; it does not saturate. The same type is also emitted as the integer 1..5 at src/rust/server/verify.rs:127, so shipped code has two JSON forms of a trust level. +* Code 0: the models read it as Level1 (ClampTrustBounds.idr:69 'below minimum: treat as minimum trust'); the Idris ABI type gives it a sixth constructor Untrusted = 0 (src/abi/EchidnaABI/Types.idr:385-396, identical copy at src/abi/Types.idr); the Rust enum has five variants 1..5 and cannot represent it (crates/echidna-core-creusot/src/lib.rs:94-105). An unset Cap'n Proto trustLevel reads 0 because the field has no default (proof.capnp:27), while minTrustLevel defaults to 2 (proof.capnp:15). +* Upward saturation: the models turn every code above 5 into Level5 (ClampTrust.agda:135; ClampTrustBounds.idr:163). The Rust does not do this anywhere; adopted as a decoder it would read a malformed byte as maximum trust. +* Precondition not modelled and not enforced: clamp_trust has no assert (lib.rs:282-290). With min_level > max_level it returns out-of-range values and inverts order: reading the branches, clamp_trust(Level1, Level5, Level1) = Level5 and clamp_trust(Level5, Level5, Level1) = Level1. std Ord::clamp panics in that case. +* The bounds theorems credit the clamp with a fact that does not depend on it: 1 <= value <= 5 holds for every level and a constant map satisfies both (reviewer's scratch module, rechecked here with agda --safe --without-K --cubical-compatible, exit 0, Agda 2.6.3 not the pin, so not a receipt). docs/PROOF-STATUS.adoc:449-474 says the bounds carry to clamp_trust; they carry to TrustLevel::value (lib.rs:127). It also cites lib.rs:274 at :463; the function is at :282. +* clamp-idempotent's comment ('lands on a real level, not between two', ClampTrust.agda:142-144) is guaranteed by the codomain type; the statement at :147 is cong over the round trip, not a property of the Rust clamp. MetaChecker.agda:67 repeats 'The clamp is idempotent'. +* The written Creusot contract on clamp_trust is bounds only (lib.rs:278-281); a function that always returns min_level satisfies it. The contract on value() has one ensures in the attribute (lib.rs:127) while its doc comment lists three (:122-126). +* No contract in the crate can be discharged as it stands: the creusot feature is empty and the dependency is commented out (crates/echidna-core-creusot/Cargo.toml:18, :24) while lib.rs:69-70 imports creusot_contracts under that feature. There is no Verus text for this crate. +* The crate header says it is not a runtime dependency (crates/echidna-core-creusot/src/lib.rs:14), but echidna-core depends on it and re-exports it (crates/echidna-core/Cargo.toml:24; crates/echidna-core/src/lib.rs:35), confidence.rs uses TrustLevel from there (src/rust/verification/confidence.rs:24), and value() is called at src/rust/verification/pareto.rs:76-77 and :115. Contracts on it are contracts on shipped code. +* Stale reason in the Agda header: ClampTrust.agda:9-14 says the Idris corpus is in no gate, but .github/workflows/dogfood-proofs-ci.yml:182-227 runs just proofs-verif-idris and ClampTrustBounds is in verification/proofs/idris2/echidna-verif-proofs.ipkg:25. Whether that job passes on main was not checked. +* Idris file drift: the clamp_monotone docstring (ClampTrustBounds.idr:225-229) describes a proof by classifyNat and zone lemmas that the proof does not use; the comment at :313 calls five Refl lines surjectivity. +* Removal is not local: retiring ClampTrust.agda breaks meta-checker/src/Echidna/MetaChecker.agda:108 (public import), :152-155 (aliases) and the summary at :63-67; the receipt docs/reports/2026-11-04-agda-meta-checker-receipt.json:30 and :104; and meta-checker/README.adoc:62-66. ClampTrustBounds must also leave echidna-verif-proofs.ipkg:25. + +=== Open questions + +* Keep or delete clamp_trust (owner). Reading A: keep it, and the clamp_trust successor (bounds plus three functional clauses) becomes a Rust obligation for Creusot and Verus. Reading B: delete it as dead code that repeats Ord::clamp, and R10 leaves nothing on clamp_trust. The source cannot settle this; no caller exists either way. +* What trust code 0 means on the wire (owner). Reading A: error, reject it (the first pass's advice; matches the Rust, which cannot represent 0). Reading B: Untrusted, a sixth level (src/abi/EchidnaABI/Types.idr:386). Reading C: unset field, read as lowest trust (the models; Cap'n Proto default at proof.capnp:27). The Idris2 code obligation cannot be stated until this is ruled. +* Which form of a trust level is the interface: the integer 1..5 (src/rust/server/verify.rs:127, the capnp UInt8 fields) or the name "LevelN" (serde derive, src/rust/dispatch.rs:65-70). Both ship today. The successor is written for the integer code; if the name form is the interface, the obligation changes shape. +* Label differences with other areas for the same file statements. The Idris corpus area lists the 15 literal order lemmas (ClampTrustBounds.idr:178-221) as rust on TrustLevel's order; here they retire with that same contract named as successor. The R4 area retires all key-* aliases in MetaChecker.agda as one group; here key-clamp-1 and key-clamp-2 follow clamp-lower and clamp-upper to rust. The content agrees in each case; the doc needs one label. +* Whether Creusot and Verus accept the code as written: value() is an enum-to-integer cast (lib.rs:129) and clamp_trust compares through the derived PartialOrd (lib.rs:283-285). Neither tool is installed here, so whether the bodies must change (a match, or comparing codes) is unverified. +* Generic clamp algebra (bounded, monotone, idempotent on any total order) is stated nowhere. If the owner wants it as theory its home would be mathesis, not echidna; no ruling extends D-10 from status tokens to trust levels. This placement does not add it. +* lteLit (NatLte.idr:33): when it can go depends on the Idris corpus area's verdict on ProverKindInjectivity.idr, its only other user. Not settled here. +* Not run: Idris 2 (no binary here), Creusot, Verus, Rocq, Lean. The one Agda recheck used Agda 2.6.3 with Debian stdlib, not the pinned toolchain, so it is evidence for the verdicts and not a receipt. + +== R4: engineering modules of the meta-checker + +_Files:_ `meta-checker/src/Echidna/AxiomSafety.agda`, `meta-checker/src/Echidna/AxiomTrackerCompleteness.agda`, `meta-checker/src/Echidna/Composition.agda`, `meta-checker/src/Echidna/Dispatch.agda`, `meta-checker/src/Echidna/MetaChecker.agda`, `meta-checker/src/Echidna/Portfolio.agda`, `meta-checker/src/Echidna/Receipt.agda`, `meta-checker/src/Echidna/TrustLevel.agda`, `src/abi/EchidnaABI/AxiomTracker.idr`, `src/rust/prove_contract.rs` + +[cols="2,3,1,2,4,3",options="header"] +|=== +|Statement |Says |Home |Rust target |Obligation or successor |Why +|`meta-checker/src/Echidna/TrustLevel.agda:65` + +≤ₜ-refl |The model order on the five trust levels is reflexive. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (derived Ord) and TrustLevel::value` |TrustLevel order embedding: logic fn level(t) in 1..=5, injective, with (a <= b) == (level(a) <= level(b)) for the derived Ord; value() ensures result == level(self). |It is the ordering of a Rust enum; nothing ties the Agda table to the derived Ord. Undisputed. +|`meta-checker/src/Echidna/TrustLevel.agda:76` + +≤ₜ-antisym |The model order is antisymmetric. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (derived Ord) and TrustLevel::value` |TrustLevel order embedding: logic fn level(t) in 1..=5, injective, with (a <= b) == (level(a) <= level(b)) for the derived Ord; value() ensures result == level(self). |Ordering of a Rust enum; needs the injectivity clause. Undisputed. +|`meta-checker/src/Echidna/TrustLevel.agda:87` + +≤ₜ-trans |The model order is transitive. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (derived Ord)` |TrustLevel order embedding: logic fn level(t) in 1..=5, injective, with (a <= b) == (level(a) <= level(b)) for the derived Ord; value() ensures result == level(self). |Ordering of a Rust enum. Undisputed. +|`meta-checker/src/Echidna/TrustLevel.agda:114` + +≤ₜ-total |Any two model trust levels are comparable. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (derived Ord)` |TrustLevel order embedding: logic fn level(t) in 1..=5, injective, with (a <= b) == (level(a) <= level(b)) for the derived Ord; value() ensures result == level(self). |Ordering of a Rust enum; src/rust/dispatch.rs:680 relies on it for the minimum-trust test. Undisputed. +|`meta-checker/src/Echidna/TrustLevel.agda:154` + +min-trust-lb-left |The model minimum of two levels is below the first. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::min_level and combine_trust` |min_level(a, b): ensures result <= a, result <= b, result == a \|\| result == b; combine_trust: ensures result == min_level(a, b). Written (lib.rs:142-146, 254-258), not discharged. |Kept against the review, which wanted retire as dead code. The functions exist, are public in the published kernel crate and already carry these contracts; what is missing is a caller (none in echidna or echidnabot). See unresolved. +|`meta-checker/src/Echidna/TrustLevel.agda:177` + +min-trust-lb-right |The model minimum of two levels is below the second. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::min_level and combine_trust` |min_level(a, b): ensures result <= a, result <= b, result == a \|\| result == b; combine_trust: ensures result == min_level(a, b). Written (lib.rs:142-146, 254-258), not discharged. |Same as min-trust-lb-left: kept against the review; no caller exists. See unresolved. +|`meta-checker/src/Echidna/TrustLevel.agda:231` + +dangerous-axioms-cap-at-level1 |The model cap function returns Level1 for Warning or Reject danger. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |compute_trust_level: ensures worst_axiom_danger >= Warning ==> result == Level1 (written, lib.rs:326-333, not discharged). Caller half, new: every dispatch path passes the maximum danger over all usages (the cross-checked path passes the first usage's, src/rust/dispatch.rs:643-645, 851-855). |The cap is a property of the shipped function. The Agda proof is refl on a model function the Rust lacks, so only the property moves. Same fact as Dispatch.dangerous-axioms-level1. +|`meta-checker/src/Echidna/TrustLevel.agda:239` + +safe-axioms-preserve-trust |The model cap function leaves the level unchanged for Safe danger. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |compute_trust_level: ensures (result == Level1) == (worst_axiom_danger >= Warning \|\| !solver_integrity_ok); Safe and Noted give the same result, other fields equal. New. |Review dispute changed the verdict from retire. The converse of the cap is true of the Rust (the only Level1 returns are lib.rs:354-368, the floor is Level2 at lib.rs:404) and is stated nowhere; its sibling cap statement already moves to Rust. +|`meta-checker/src/Echidna/TrustLevel.agda:251` + +cap-monotonic |For a fixed danger the model cap is monotone in the level. |`retire` |— |compute_trust_level (TK-6): with class, danger and integrity equal, more confirming_provers, more small_kernel_confirmations or a certificate becoming produced and verified never lowers the level. Test only today. |A function that is constant or the identity is monotone, and the Rust has no pre-cap level. The review corrects the reason: its Rust form is the fixed-danger case of TK-6, which Portfolio.cross-check-improves-trust carries. +|`meta-checker/src/Echidna/AxiomSafety.agda:111` + +≤ₚ-refl |The four-point policy order is reflexive. |`rust` |`crates/echidna-core-creusot/src/axiom_tracker.rs::DangerLevel and src/rust/verification/axiom_tracker.rs::DangerLevel (derived Ord)` |DangerLevel order embedding on both enums: logic fn rank (Safe=0, Noted=1, Warning=2, Reject=3), injective, with (a <= b) == (rank(a) <= rank(b)); the bridge at src/rust/verification/confidence.rs:67-72 preserves rank. |The Rust AxiomPolicy has no Ord; the order that exists and is used is on DangerLevel. Review upheld on the seam: the order across the encodings is a separate idris2 row (AxiomTracker.idr:66). +|`meta-checker/src/Echidna/AxiomSafety.agda:118` + +≤ₚ-trans |The four-point policy order is transitive. |`rust` |`crates/echidna-core-creusot/src/axiom_tracker.rs::DangerLevel and src/rust/verification/axiom_tracker.rs::DangerLevel (derived Ord)` |DangerLevel order embedding on both enums: logic fn rank (Safe=0, Noted=1, Warning=2, Reject=3), injective, with (a <= b) == (rank(a) <= rank(b)); the bridge at src/rust/verification/confidence.rs:67-72 preserves rank. |Same as ≤ₚ-refl. Only reflexivity and transitivity are proved; MetaChecker's 'total preorder' (MetaChecker.agda:18) has no totality statement. +|`meta-checker/src/Echidna/AxiomSafety.agda:145` + +worst-ub-left |The worse of two policies is above the first. |`rust` |`crates/echidna-core-creusot/src/axiom_tracker.rs::DangerLevel::max_danger` |max_danger(a, b): ensures result >= a, result >= b, result == a \|\| result == b (written, kernel axiom_tracker.rs:84-88, not discharged). Unit, commutativity, associativity and absorption follow. |The Rust join is max_danger on DangerLevel. Review corrects the reason: it is live code, called by echidnabot (its src/trust/axiom_tracker.rs:186, 189, 215, 291) through echidna_core::trust. +|`meta-checker/src/Echidna/AxiomSafety.agda:170` + +worst-ub-right |The worse of two policies is above the second. |`rust` |`crates/echidna-core-creusot/src/axiom_tracker.rs::DangerLevel::max_danger` |max_danger(a, b): ensures result >= a, result >= b, result == a \|\| result == b (written, kernel axiom_tracker.rs:84-88, not discharged). Unit, commutativity, associativity and absorption follow. |Same as worst-ub-left. +|`meta-checker/src/Echidna/AxiomSafety.agda:160` + +clean-left-neutral |Clean is a left unit of worst-policy. |`retire` |— |max_danger(a, b): ensures result >= a, result >= b, result == a \|\| result == b (written, kernel axiom_tracker.rs:84-88, not discharged). Unit, commutativity, associativity and absorption follow. |Review dispute changed the verdict from agda-theory. It is a library law (agda-stdlib max) on a four-point table and a corollary of the max_danger postconditions. Ruling D-10 covers the five PROOF-POLICY §5 status tokens, not this chain (mathesis docs/status/PROOF-NEEDS.adoc, 'To be allocated' row). +|`meta-checker/src/Echidna/AxiomSafety.agda:189` + +worst-comm |worst-policy is commutative. |`retire` |— |max_danger(a, b): ensures result >= a, result >= b, result == a \|\| result == b (written, kernel axiom_tracker.rs:84-88, not discharged). Unit, commutativity, associativity and absorption follow. |Review dispute changed the verdict from agda-theory: library instance and corollary of the max_danger postconditions, as clean-left-neutral. +|`meta-checker/src/Echidna/AxiomSafety.agda:214` + +worst-assoc |worst-policy is associative. |`retire` |— |max_danger(a, b): ensures result >= a, result >= b, result == a \|\| result == b (written, kernel axiom_tracker.rs:84-88, not discharged). Unit, commutativity, associativity and absorption follow. |Review dispute changed the verdict from agda-theory: library instance, used only by fold-worst-++, as clean-left-neutral. +|`meta-checker/src/Echidna/AxiomSafety.agda:283` + +rejected-absorbing |Rejected absorbs on the left of worst-policy. |`retire` |— |max_danger(a, b): ensures result >= a, result >= b, result == a \|\| result == b (written, kernel axiom_tracker.rs:84-88, not discharged). Unit, commutativity, associativity and absorption follow. |Review dispute changed the verdict from agda-theory: it restates the first defining clause of worst-policy and follows from the max_danger postconditions. Same fact as AxiomTrackerCompleteness.rejected-left-absorbing. +|`meta-checker/src/Echidna/AxiomSafety.agda:299` + +clean-identity-right |Clean is a right unit of worst-policy. |`retire` |— |max_danger(a, b): ensures result >= a, result >= b, result == a \|\| result == b (written, kernel axiom_tracker.rs:84-88, not discharged). Unit, commutativity, associativity and absorption follow. |Review dispute changed the verdict from agda-theory: library instance and corollary, as clean-left-neutral. +|`meta-checker/src/Echidna/AxiomSafety.agda:293` + +clean-identity-left |Clean is a left unit of worst-policy. |`retire` |— |max_danger(a, b): ensures result >= a, result >= b, result == a \|\| result == b (written, kernel axiom_tracker.rs:84-88, not discharged). Unit, commutativity, associativity and absorption follow. |Verbatim duplicate of clean-left-neutral in the same file; same successor. +|`meta-checker/src/Echidna/AxiomSafety.agda:265` + +comment-skip-sound |For any pattern record, danger-to-policy of DC-Safe is Clean. |`retire` |— |New obligation on AxiomTracker::scan (shipped and kernel), no existing statement: every registered pattern on a line that is not wholly a comment yields a usage; a comment opener at line start must not hide a construct later on that line (false today). |The conclusion ignores the pattern and the in-comment hypothesis; the proof is refl. It says nothing about comment skipping. The property the name claims is a new Rust obligation and is false today. +|`meta-checker/src/Echidna/AxiomSafety.agda:272` + +real-pattern-classified |For every danger class some policy equals danger-to-policy of it. |`retire` |— |New obligation on AxiomTracker::scan (shipped and kernel), no existing statement: every registered pattern on a line that is not wholly a comment yields a usage; a comment opener at line start must not hide a construct later on that line (false today). |True of any total function. It does not say that a pattern outside a comment is found; that is the new scan obligation. +|`meta-checker/src/Echidna/Portfolio.agda:59` + +cross-check-improves-trust |In the model table, CrossChecked scores at least SingleSolver for the same kernel flag. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |compute_trust_level (TK-6): with class, danger and integrity equal, more confirming_provers, more small_kernel_confirmations or a certificate becoming produced and verified never lowers the level. Test only today. |Only the intent moves: the table portfolio-trust has no Rust counterpart and matches no slice of compute_trust_level. Undisputed. +|`meta-checker/src/Echidna/Portfolio.agda:121` + +small-kernel-higher |In the model table, the small-kernel flag never lowers the level. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level; src/rust/verification/confidence.rs::is_small_kernel_prover` |compute_trust_level: other fields equal, SmallKernel never scores below Other. New; untested. |The table retires; monotonicity in the prover class is a property of the shipped function and is untested. Undisputed. +|`meta-checker/src/Echidna/Portfolio.agda:68` + +inconclusive-is-level1 |The model table gives Level1 for Inconclusive. |`retire` |— |none |Models behaviour the Rust lacks: compute_trust_level never reads portfolio_confidence, and the cross-checked path scores by the count of proving attempts (src/rust/dispatch.rs:846, 873-884). Whether disagreement should force Level1 is an owner decision; see unresolved. +|`meta-checker/src/Echidna/Portfolio.agda:77` + +timeout-is-level1 |The model table gives Level1 for AllTimedOut. |`retire` |— |none |Models behaviour the Rust lacks: with zero confirming provers the kernel returns Level2 (lib.rs:404), and dispatch computes the level whether or not the proof was proved. +|`meta-checker/src/Echidna/Portfolio.agda:92` + +agree-refl-valid |agree Valid Valid evaluates to true. |`retire` |— |reconcile: AllTimedOut == no result has a verdict; CrossChecked ==> two or more completed results, all equal, verified == Some(that); Inconclusive == two completed results differ, then verified == None and needs_review. arbitrate / outcome_to_verdict: only Proven and Refuted count as a verdict, under every policy. |A closed term, true by definition of the model function agree. Its intent is the CrossChecked clause of the reconcile contract. +|`meta-checker/src/Echidna/Portfolio.agda:95` + +agree-refl-invalid |agree Invalid Invalid evaluates to true. |`retire` |— |reconcile: AllTimedOut == no result has a verdict; CrossChecked ==> two or more completed results, all equal, verified == Some(that); Inconclusive == two completed results differ, then verified == None and needs_review. arbitrate / outcome_to_verdict: only Proven and Refuted count as a verdict, under every policy. |As agree-refl-valid. The Rust maps NoProofFound to Refuted (result_arbiter.rs:222), so two failed searches agree; the model's Invalid means a counterexample. +|`meta-checker/src/Echidna/Portfolio.agda:99` + +agree-sym |The model function agree is symmetric. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |reconcile: verified, confidence and needs_review are invariant under permutation of the input. Record that agreeing_solvers, disagreeing_solvers and the Portfolio conflict ratio (result_arbiter.rs:358-364) are not. |Review dispute changed the verdict from retire. reconcile compares every completed result with the first (portfolio.rs:128-138): the verdict is order-independent, but the disagreeing list and conflict ratio are not ([T,F,F] gives 2, [F,T,F] gives 1). Read and hand-evaluated, not run. +|`meta-checker/src/Echidna/Portfolio.agda:133` + +opposite-verdict-disagree |agree Valid Invalid evaluates to false. |`retire` |— |reconcile: AllTimedOut == no result has a verdict; CrossChecked ==> two or more completed results, all equal, verified == Some(that); Inconclusive == two completed results differ, then verified == None and needs_review. arbitrate / outcome_to_verdict: only Proven and Refuted count as a verdict, under every policy. |Kept against the review, which wanted rust. It is a closed term like agree-refl-valid, which the review leaves retired; its intent is the Inconclusive clause of the reconcile contract, named here as successor. The review's Bayesian finding is the added row for Portfolio.agda:8. +|`meta-checker/src/Echidna/Portfolio.agda:137` + +unknown-never-agrees |agree Unknown v is false for every verdict v. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile; src/rust/verification/result_arbiter.rs::ResultArbiter::arbitrate and outcome_to_verdict` |reconcile: AllTimedOut == no result has a verdict; CrossChecked ==> two or more completed results, all equal, verified == Some(that); Inconclusive == two completed results differ, then verified == None and needs_review. arbitrate / outcome_to_verdict: only Proven and Refuted count as a verdict, under every policy. |Home unchanged; the review corrected the target and the reason. The Rust has a five-state Verdict (src/rust/verification/bayesian_arbiter.rs:26-32); 'no verdict never agrees' is the mapping at result_arbiter.rs:329-333, 406 and 451, not only reconcile's filter. +|`meta-checker/src/Echidna/Dispatch.agda:68` + +failed-integrity-level1 |In the model, a failed integrity flag gives Level1. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level; src/rust/dispatch.rs (integrity flag, three sites)` |compute_trust_level: ensures !solver_integrity_ok ==> result == Level1 (written, lib.rs:334, not discharged). Dispatch half, new: one shared function for the flag (src/rust/dispatch.rs:648-661, 858-871, 1009-1022) with ensures result ==> the prover's integrity report exists and is Verified. |The kernel half holds as stated; the flag it reads is computed permissively by dispatch, so the hypothesis is almost never reachable (DEBT D9). Undisputed. +|`meta-checker/src/Echidna/Dispatch.agda:84` + +dangerous-axioms-level1 |In the model, Reject danger gives Level1. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |compute_trust_level: ensures worst_axiom_danger >= Warning ==> result == Level1 (written, lib.rs:326-333, not discharged). Caller half, new: every dispatch path passes the maximum danger over all usages (the cross-checked path passes the first usage's, src/rust/dispatch.rs:643-645, 851-855). |Same fact as TrustLevel.dangerous-axioms-cap-at-level1. The kernel half holds; the caller half fails on the cross-checked path. Undisputed. +|`meta-checker/src/Echidna/Dispatch.agda:98` + +max-trust-requires-all |In the model, Level5 needs integrity, certificate, small kernel and cross-check. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |compute_trust_level: ensures (result == Level5) == (solver_integrity_ok && worst_axiom_danger <= Noted && prover_class == SmallKernel && has_certificate && certificate_verified && small_kernel_confirmations >= 2 && confirming_provers >= 2). TK-4 and TK-5 (lib.rs:335-343) are the written implications. |Property of the shipped function, but the Agda model is the rule #477 replaced (one certificate flag, a cross-checked Bool). No dispatch path reaches Level4 or Level5 today. Undisputed. +|`meta-checker/src/Echidna/Dispatch.agda:133` + +pipeline-monotonic |The model cap never raises the level. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |compute_trust_level: other fields equal, f.worst_axiom_danger <= g.worst_axiom_danger ==> level(g) <= level(f); solver_integrity_ok false to true never lowers the level. New. |Review dispute changed the verdict from retire. 'Danger never raises trust' (header claim 2, Dispatch.agda:8) is true of the Rust by lib.rs:354-368 and no contract or test states it; TK-6 holds the danger fixed, so it does not cover it. +|`meta-checker/src/Echidna/Dispatch.agda:145` + +pipeline-deterministic |Equal inputs give equal model results. |`retire` |— |none |An instance of cong, true of every function. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:69` + +scan-entry-length |Mapping danger-to-policy over an entry's list keeps its length. |`retire` |— |New obligation on AxiomTracker::scan (shipped and kernel), no existing statement: every registered pattern on a line that is not wholly a comment yields a usage; a comment opener at line start must not hide a construct later on that line (false today). |An instance of length-map. The model has no proof text, pattern strings or matching, so it does not show 'no silent omissions'; that is the new scan obligation. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:80` + +fold-worst-++ |Folding worst-policy over an appended list equals the worse of the two folds. |`retire` |— |Worst danger is the maximum over usages, on one shared function that dispatch calls: ensures forall i. usages[i].danger_level <= result; empty ==> Safe; non-empty ==> some usage has danger == result. |Review dispute changed the verdict from agda-theory. It is the library fold-over-append law; mathesis ladder row 12 is the fold of §5 status tokens, not of axiom policies; the Rust side is the stronger 'result is the maximum' contract. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:92` + +fold-worst-prepend-monotonic |Prepending a policy never lowers the fold. |`rust` |`crates/echidna-core-creusot/src/axiom_tracker.rs::classify_axiom; src/rust/dispatch.rs (worst-danger computation)` |Worst danger is the maximum over usages, on one shared function that dispatch calls: ensures forall i. usages[i].danger_level <= result; empty ==> Safe; non-empty ==> some usage has danger == result. |Monotonicity of a specific Rust computation. classify_axiom has no caller and dispatch recomputes the maximum inline three times, so the contract belongs on one shared function. Undisputed. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:101` + +empty-registry-clean |The fold over the scan of an empty registry is Clean. |`rust` |`src/rust/verification/axiom_tracker.rs::AxiomTracker::scan; crates/echidna-core-creusot/src/axiom_tracker.rs::AxiomTracker::scan` |scan: a prover with no pattern table yields no usages, so danger Safe (fail open; shipped axiom_tracker.rs:285, kernel axiom_tracker.rs:511-513). State it as an explicit contract or change it to fail closed. |Home unchanged; review dispute changed the target. The model's empty registry is 'no patterns registered', which in the Rust is the missing-table branch of scan, not the is_empty return of enforce_policy. It is fail open for Metamath, HOLLight, Twelf, Nuprl and Minlog (small-kernel in confidence.rs:85-100). See unresolved. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:109` + +single-reject-detected |A one-element Reject entry folds to Rejected, for any prover tag. |`retire` |— |enforce_policy (shipped and kernel): ensures (some usage is Reject) == (result is Rejected); in full, result.worst_danger() == maximum danger over usages, Clean when none. Needs the worst_danger table as a contract (Clean->Safe, ClassicalAxioms->Noted, IncompleteProof->Warning, Rejected->Reject); the table has no Agda ancestor. |The instance of reject-head-propagates at the empty tail; the prover argument is unused and nothing is scanned. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:119` + +reject-head-propagates |A list of danger classes whose head is Reject folds to Rejected. |`rust` |`src/rust/verification/axiom_tracker.rs::AxiomTracker::enforce_policy; crates/echidna-core-creusot/src/axiom_tracker.rs::AxiomTracker::enforce_policy` |enforce_policy (shipped and kernel): ensures (some usage is Reject) == (result is Rejected); in full, result.worst_danger() == maximum danger over usages, Clean when none. Needs the worst_danger table as a contract (Clean->Safe, ClassicalAxioms->Noted, IncompleteProof->Warning, Rejected->Reject); the table has no Agda ancestor. |Soundness half of the enforce_policy contract. Agda states it only for the head position; Idris 2 (src/abi/EchidnaABI/AxiomTracker.idr:149 soundness) and SPARK state it for any position. enforce_policy is not on the dispatch path. Undisputed. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:127` + +worst-policy-rejected-inv |If the worse of two policies is Rejected, one of them is Rejected. |`rust` |`src/rust/verification/axiom_tracker.rs::AxiomTracker::enforce_policy; crates/echidna-core-creusot/src/axiom_tracker.rs::DangerLevel::max_danger` |enforce_policy (shipped and kernel): ensures (some usage is Reject) == (result is Rejected); in full, result.worst_danger() == maximum danger over usages, Clean when none. Needs the worst_danger table as a contract (Clean->Safe, ClassicalAxioms->Noted, IncompleteProof->Warning, Rejected->Reject); the table has no Agda ancestor. |Precision half: no false Rejected. On max_danger it is the written ensures result == a \|\| result == b. Undisputed. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:139` + +rejected-left-absorbing |Rejected absorbs on the left of worst-policy. |`retire` |— |max_danger(a, b): ensures result >= a, result >= b, result == a \|\| result == b (written, kernel axiom_tracker.rs:84-88, not discharged). Unit, commutativity, associativity and absorption follow. |Same fact as AxiomSafety.rejected-absorbing, restated in a module that imports it; same successor. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:150` + +scan-deterministic |Equal registries give equal folded scans. |`retire` |— |none |An instance of cong. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:159` + +reject-maps-to-rejected |danger-to-policy of DC-Reject is Rejected. |`retire` |— |enforce_policy (shipped and kernel): ensures (some usage is Reject) == (result is Rejected); in full, result.worst_danger() == maximum danger over usages, Clean when none. Needs the worst_danger table as a contract (Clean->Safe, ClassicalAxioms->Noted, IncompleteProof->Warning, Rejected->Reject); the table has no Agda ancestor. |Review dispute changed the verdict from rust. It is a defining clause of the model function, and the colleague's target was the inverse map (worst_danger is policy to danger, shipped axiom_tracker.rs:62-69). The danger-to-policy direction is the enforce_policy contract; its cross-language form is enforcePolicySpec (AxiomTracker.idr:136-141). +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:162` + +warning-maps-to-incomplete |danger-to-policy of DC-Warning is IncompleteProof. |`retire` |— |enforce_policy (shipped and kernel): ensures (some usage is Reject) == (result is Rejected); in full, result.worst_danger() == maximum danger over usages, Clean when none. Needs the worst_danger table as a contract (Clean->Safe, ClassicalAxioms->Noted, IncompleteProof->Warning, Rejected->Reject); the table has no Agda ancestor. |Review dispute changed the verdict from rust, as reject-maps-to-rejected. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:165` + +noted-maps-to-classical |danger-to-policy of DC-Noted is ClassicalAxioms. |`retire` |— |enforce_policy (shipped and kernel): ensures (some usage is Reject) == (result is Rejected); in full, result.worst_danger() == maximum danger over usages, Clean when none. Needs the worst_danger table as a contract (Clean->Safe, ClassicalAxioms->Noted, IncompleteProof->Warning, Rejected->Reject); the table has no Agda ancestor. |Review dispute changed the verdict from rust, as reject-maps-to-rejected. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:168` + +safe-maps-to-clean |danger-to-policy of DC-Safe is Clean. |`retire` |— |enforce_policy (shipped and kernel): ensures (some usage is Reject) == (result is Rejected); in full, result.worst_danger() == maximum danger over usages, Clean when none. Needs the worst_danger table as a contract (Clean->Safe, ClassicalAxioms->Noted, IncompleteProof->Warning, Rejected->Reject); the table has no Agda ancestor. |Review dispute changed the verdict from rust, as reject-maps-to-rejected. This clause is also the whole content of comment-skip-sound. +|`meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:176` + +add-rejected-entry-makes-rejected |Prepending a one-element Reject entry to any registry makes the folded scan Rejected. |`retire` |— |enforce_policy (shipped and kernel): ensures (some usage is Reject) == (result is Rejected); in full, result.worst_danger() == maximum danger over usages, Clean when none. Needs the worst_danger table as a contract (Clean->Safe, ClassicalAxioms->Noted, IncompleteProof->Warning, Rejected->Reject); the table has no Agda ancestor. |Review dispute changed the verdict from rust. Like single-reject-detected, it is one more shape of the membership contract that reject-head-propagates carries. +|`meta-checker/src/Echidna/Composition.agda:103` + +cut |If Γ₁ entails φ and φ,Γ₂ entails ψ then Γ₁++Γ₂ entails ψ, for any logic. |`agda-theory` |— |Stays Agda, generic over the logic; recheck in Rocq and Lean. Ungraded until a source-bound receipt covers Composition.agda (PROOF-STATUS R6). |Parameterised over an arbitrary logic; names no echidna type. No Rust composes proofs. Review confirms. +|`meta-checker/src/Echidna/Composition.agda:109` + +weaken-right |Adding axioms on the right preserves an entailment. |`agda-theory` |— |Stays Agda, generic over the logic; recheck in Rocq and Lean. Ungraded until a source-bound receipt covers Composition.agda (PROOF-STATUS R6). |Generic, as cut. Missing from the PROOF-STATUS census of Composition theorems. +|`meta-checker/src/Echidna/Composition.agda:112` + +weaken-left |Adding axioms on the left preserves an entailment. |`agda-theory` |— |Stays Agda, generic over the logic; recheck in Rocq and Lean. Ungraded until a source-bound receipt covers Composition.agda (PROOF-STATUS R6). |Generic, as cut. Also missing from the census. +|`meta-checker/src/Echidna/Composition.agda:120` + +explosion |An axiom set with no model entails every formula. |`agda-theory` |— |Stays Agda, generic over the logic; recheck in Rocq and Lean. Ungraded until a source-bound receipt covers Composition.agda (PROOF-STATUS R6). |Generic, as cut. +|`meta-checker/src/Echidna/Composition.agda:130` + +compose-realised |With a sound conflict detector and no reported conflict, some model satisfies the composite's axioms and goal. |`agda-theory` |— |Stays Agda, generic over the logic; recheck in Rocq and Lean. Ungraded until a source-bound receipt covers Composition.agda (PROOF-STATUS R6). |Generic over the logic and the detector. It is what a future Rust composer's conflict check must meet. +|`meta-checker/src/Echidna/Composition.agda:139` + +detector-cannot-miss |For a sound detector, 'no conflict' is refutable when the joined axioms are inconsistent. |`agda-theory` |— |Stays Agda, generic over the logic; recheck in Rocq and Lean. Ungraded until a source-bound receipt covers Composition.agda (PROOF-STATUS R6). |Generic, as cut. +|`meta-checker/src/Echidna/Composition.agda:145` + +detector-must-flag |A sound detector that decides its relation returns a conflict witness for every inconsistent composition. |`agda-theory` |— |Stays Agda, generic over the logic; recheck in Rocq and Lean. Ungraded until a source-bound receipt covers Composition.agda (PROOF-STATUS R6). |Generic, as cut. +|`meta-checker/src/Echidna/Composition.agda:77` + +join, left, right (77, 81, 85) and compose (106) |Satisfaction of a context splits and joins across list append; compose packages cut as a certified proof. |`agda-theory` |— |Stays Agda, generic over the logic; recheck in Rocq and Lean. Ungraded until a source-bound receipt covers Composition.agda (PROOF-STATUS R6). |Supporting lemmas and one construction for the theory; they stay with it and are not graded separately. +|`meta-checker/src/Echidna/Composition.agda:156` + +Literals: true≢false, clash, clash-entails-anything, lemma₁, lemma₂, composed (167-186) |In a concrete literal logic, pos 0 and neg 0 have no common model; a real two-step composition is exhibited. |`agda-theory` |— |Stays Agda, generic over the logic; recheck in Rocq and Lean. Ungraded until a source-bound receipt covers Composition.agda (PROOF-STATUS R6). |Non-vacuity witnesses for the generic theorems. They are controls for the theory, not toy claims about the system, so they stay with it, ungraded. +|`meta-checker/src/Echidna/Receipt.agda:82` + +receipt-factive |In the coarse two-world frame, a receipt at a world gives the claim at that world. |`agda-theory` |— |Stays Agda (inside the R4 receipt); recheck in Rocq and Lean. Owner of the receipt/warrant theory to be decided. |Names no echidna Rust type, only a Kripke frame and the §5 tokens. Counterparts exist in echidnabot proofs/agda/ReceiptBoundary.agda and in epistemic-types. +|`meta-checker/src/Echidna/Receipt.agda:116` + +warrant-not-factive |There is a world where a warrant for the claim is held and the claim is false. |`agda-theory` |— |Stays Agda (inside the R4 receipt); recheck in Rocq and Lean. Owner of the receipt/warrant theory to be decided. |Countermodel theory; one frame is the right shape for an existence claim. +|`meta-checker/src/Echidna/Receipt.agda:124` + +warrant-not-receipt |At w-there no receipt for sound exists. |`agda-theory` |— |Stays Agda (inside the R4 receipt); recheck in Rocq and Lean. Owner of the receipt/warrant theory to be decided. |Theory. It is the w-there case of no-receipt-anywhere with an unused hypothesis, so it could be dropped in favour of that. +|`meta-checker/src/Echidna/Receipt.agda:130` + +no-receipt-anywhere |In the coarse frame no world has a receipt for sound. |`agda-theory` |— |Stays Agda (inside the R4 receipt); recheck in Rocq and Lean. Owner of the receipt/warrant theory to be decided. |Countermodel theory. +|`meta-checker/src/Echidna/Receipt.agda:165` + +receipt′-factive |In the sharpened frame a receipt is still factive. |`agda-theory` |— |Stays Agda (inside the R4 receipt); recheck in Rocq and Lean. Owner of the receipt/warrant theory to be decided. |Theory; one statement over any reflexive frame would cover this and receipt-factive. +|`meta-checker/src/Echidna/Receipt.agda:198` + +frame-receipt-factive |A receipt is factive in either frame. |`agda-theory` |— |Stays Agda (inside the R4 receipt); recheck in Rocq and Lean. Owner of the receipt/warrant theory to be decided. |Theory; a case split over the two factivity lemmas. +|`meta-checker/src/Echidna/Receipt.agda:222` + +false-sample-rejected |An all-passing sample vector cannot contain the world where the claim is false. |`agda-theory` |— |Stays Agda (inside the R4 receipt); recheck in Rocq and Lean. Owner of the receipt/warrant theory to be decided. |Theory about the tested-only token; no Rust test runner is modelled. +|`meta-checker/src/Echidna/Receipt.agda:279` + +no-free-promotion |No operation turns every argued assertion into a proven one in every frame. |`agda-theory` |— |Stays Agda (inside the R4 receipt); recheck in Rocq and Lean. Owner of the receipt/warrant theory to be decided. |Theory. The estate has this result in three places (epistemic-types, echidnabot, echidna); one home should own it. +|`meta-checker/src/Echidna/Receipt.agda:290` + +no-unconditional-postulate-promotion |No operation turns every proven-with-postulates assertion into a proven one without the named assumption. |`agda-theory` |— |Stays Agda (inside the R4 receipt); recheck in Rocq and Lean. Owner of the receipt/warrant theory to be decided. |Theory about the §5 token semantics. +|`meta-checker/src/Echidna/Receipt.agda:300` + +no-test-promotion |No operation turns every tested-only assertion into a proven one. |`agda-theory` |— |Stays Agda (inside the R4 receipt); recheck in Rocq and Lean. Owner of the receipt/warrant theory to be decided. |Theory about the §5 token semantics. +|`meta-checker/src/Echidna/Receipt.agda:55` + +supporting declarations: ≈-refl (55), warrant-elsewhere (105), ≈′-refl (151), receipt-in-sharpened-frame (159), coarse-yet-sharpened (172), one-passing-sample (218), postulates-name-an-axiom (251), discharge-postulates (256), proven-in-sharpened-frame (265), warrant-and-receipt (269) |Two reflexivity helpers, three inhabitation witnesses and five projections or pairings of the theorems above. |`agda-theory` |— |Stays Agda (inside the R4 receipt); recheck in Rocq and Lean. Owner of the receipt/warrant theory to be decided. |Helpers and positive controls; they stay with the theory, ungraded. postulates-name-an-axiom and discharge-postulates are projections with no content of their own. +|`meta-checker/src/Echidna/MetaChecker.agda:119` + +23 key-* aliases (119-161) |The entrypoint re-exports the other modules and binds 23 names to theorems proved elsewhere. |`retire` |— |none |No statement of its own. After the split only the Receipt and Composition imports are theory. key-safety-5, key-safety-6 and key-tracker-1 to key-tracker-3 point at statements retired here; its summary comment overclaims and should not be copied forward. +|`meta-checker/src/Echidna/Portfolio.agda:8` + +header claim 2: 'Disagreement detection is sound' (no theorem) |The file header claims sound disagreement detection; only two closed terms on the model function agree stand behind it. |`rust` |`src/rust/dispatch.rs::ProverDispatcher::verify_proof_cross_checked; src/rust/verification/result_arbiter.rs::ResultArbiter::arbitrate` |verify_proof_cross_checked with arbitrate: one Proven and one Refuted attempt ==> verified == false and needs_review under every ArbitrationPolicy, and the min_trust_level gate is kept. Holds for Portfolio only, as read. |Added from the review (missed). Under Bayesian a verdict is always ranked (result_arbiter.rs:374-398); Coq proved against Z3 NoProofFound gives odds 19.6 x 0.054 > 1, so dispatch.rs:899-900 returns verified = true, against the comment at dispatch.rs:894-898. Hand arithmetic from source, not run. See unresolved. +|`src/abi/EchidnaABI/AxiomTracker.idr:66` + +dangerToU8 / policyToI32 code order (comment only) |A comment says the u8 danger codes match the Rust PartialOrd order; no theorem states it. |`idris2` |— |dangerRoundTrip, soundness and precision stay proved. To add: dangerToU8 and policyToI32 are strictly monotone for Safe < Noted < Warning < Reject and Clean < Classical < Incomplete < Rejected, and equal the Rust wire constants (src/rust/ffi/spark_axiom.rs:35-43) and the kernel discriminants. |Added from the review (dispute on ≤ₚ). The Agda order is on AxiomPolicy, which has no Ord in Rust; that order exists only as wire codes. Agreement of the DangerLevel encodings is what crosses the SPARK seam. +|`src/rust/prove_contract.rs:28` + +axioms_in: trust.axioms of echidna.prove.result/1 |The CLI writes the scanner's constructs to the wire field trust.axioms (crates/echidna-core/src/prove_result.rs:92), sorted and de-duplicated. |`idris2` |— |Nothing is proved today: no module under src/abi covers echidna.prove.result/1. To state: trust.axioms is the sorted, de-duplicated list of constructs returned by scan; 'empty' means 'none found' only as far as the Rust scan obligation holds. |Added from the review (missed seam). The comment-prefix false negative crosses an interface that consumers read, and it is reachable from the CLI (src/rust/prove_contract.rs:119, called from src/rust/cli/prove.rs:130). +|=== + +=== Model gaps + +* Dispatch.compute-trust is not the shipped rule. Cross-checked without a certificate is Level2 in Agda (meta-checker/src/Echidna/Dispatch.agda:61-62) and Level3 in Rust (crates/echidna-core-creusot/src/lib.rs:399-401). Agda has one has-certificate flag; Rust needs has_certificate && certificate_verified (lib.rs:373). Agda Level5 needs a cross-checked Bool; Rust needs min(small_kernel_confirmations, confirming_provers) >= 2 (lib.rs:376-386). max-trust-requires-all (Dispatch.agda:98) is about the rule #477 replaced. +* No dispatch path can produce Level4 or Level5: all three TrustFactors sites hard-code has_certificate false, certificate_verified false and small_kernel_confirmations 0 (src/rust/dispatch.rs:664-673, 873-882, 1024-1035). Every Level4/Level5 statement is about branches dispatch does not reach. +* The trust level does not depend on the verdict: dispatch computes it from the factors whether or not the prover proved the goal (src/rust/dispatch.rs:664-675) and the kernel floor is Level2 (lib.rs:404). Portfolio.inconclusive-is-level1 and timeout-is-level1 (meta-checker/src/Echidna/Portfolio.agda:68, 77) state the opposite. +* portfolio-trust (Portfolio.agda:46-53) has no Rust counterpart: compute_trust_level never reads portfolio_confidence (src/rust/verification/confidence.rs:60-82). +* SolverVerdict has four states (Portfolio.agda:26-30). The Rust has Option on SolverResult (src/rust/verification/portfolio.rs:32) and a five-state Verdict (src/rust/verification/bayesian_arbiter.rs:26-32); there is no agree function, reconcile compares each completed result with the first (portfolio.rs:128-138), and NoProofFound maps to Refuted (src/rust/verification/result_arbiter.rs:222), so two failed searches 'agree'. +* Portfolio header claim 2, 'disagreement detection is sound' (Portfolio.agda:8), is not true of every policy: under Bayesian or DempsterShafer a conclusive disagreement can still yield a verdict (result_arbiter.rs:374-431), and dispatch then returns verified = true (src/rust/dispatch.rs:899-900) although its comment says disagreement always vetoes (dispatch.rs:894-898). Default policy is Portfolio (result_arbiter.rs:151). Hand arithmetic from source, not run. +* The model has two danger enums that are never related: TrustLevel.DangerLevel (meta-checker/src/Echidna/TrustLevel.agda:212) and AxiomSafety.DangerClass (meta-checker/src/Echidna/AxiomSafety.agda:38). pipeline-monotonic uses the first, compute-trust the second (Dispatch.agda:32, 133). The Rust also has two DangerLevel enums, bridged by a hand-written match (confidence.rs:67-72). +* cap-if-dangerous (TrustLevel.agda:223), min-trust (TrustLevel.agda:138) and worst-policy on policies (AxiomSafety.agda:135) model functions the pipeline does not call. Rust has no cap function; min_level, combine_trust, clamp_trust and classify_axiom have no caller outside the kernel crate's tests; AxiomPolicy has no Ord (src/rust/verification/axiom_tracker.rs:43-53); enforce_policy is called only by analyze and the spark cross-check (axiom_tracker.rs:377, 391); dispatch takes Iterator::max inline (dispatch.rs:631-640). Review correction: max_danger is live, called by echidnabot (its src/trust/axiom_tracker.rs:186, 189, 215, 291). +* AxiomTrackerCompleteness does not model scanning: its registry is a list of danger classes per prover tag and scan-all maps them to policies (meta-checker/src/Echidna/AxiomTrackerCompleteness.agda:35-54). There is no proof text, pattern string or match; the Rust scan takes (prover, content) (axiom_tracker.rs:282). Reject at an arbitrary list position is never stated in Agda (only AxiomTrackerCompleteness.agda:119 and 176). +* ProverTag has nine tags (AxiomSafety.agda:48-57); the Rust has seven pattern tables (axiom_tracker.rs:105-276). HOLLight and Metamath have no patterns but are small-kernel (confidence.rs:85-100), as are Twelf, Nuprl and Minlog, so their content scans Safe (axiom_tracker.rs:285). The classify-* stubs return DC-Safe and no theorem uses them (AxiomSafety.agda:72-85). +* Comment skipping in the Rust is a line-prefix test that hides a real axiom later on the same line: shipped axiom_tracker.rs:290-309, kernel crates/echidna-core-creusot/src/axiom_tracker.rs:228-239 and 520-522. The colleague ran the kernel copy; the shipped copy is read only. AxiomSafety header claim 4 (AxiomSafety.agda:10) and comment-skip-sound (AxiomSafety.agda:265) do not state it and it is false of the code. +* There are two axiom scanners and they differ. The shipped one serves dispatch (dispatch.rs:623-626) and the CLI wire contract (src/rust/prove_contract.rs:28-33). The kernel one is not called by echidna but is live in echidnabot (its src/trust/axiom_tracker.rs:285). The kernel treats '/-' as a comment for Agda and Idris2 (kernel axiom_tracker.rs:230-234), the shipped one only for Lean (axiom_tracker.rs:292-294); the shipped one treats '{-#' as a comment for Idris2 (axiom_tracker.rs:302-304), the kernel does not. A contract on one says nothing about the other. +* Cross-checked dispatch loses the axiom cap: verify_proof keeps only the first usage (src/rust/dispatch.rs:643-645) and verify_proof_cross_checked recomputes the danger from it and overwrites the level (dispatch.rs:851-855, 890). Read, not run. +* Cross-checked dispatch drops the minimum-trust gate: verify_proof returns verified && meets_minimum (dispatch.rs:717), the cross-checked path resets verified with no minimum check (dispatch.rs:899-900). With the default minimum Level2 (dispatch.rs:137) a primary proof capped to Level1 comes back verified = true. The LLM advisor selects this path (dispatch.rs:493-501). Neither path has a caller in the binaries, only tests/smoke_e2e.rs:133 and dispatch.rs:495. Read, not run. +* The integrity flag is permissive at all three sites (dispatch.rs:648-661, 858-871, 1009-1022): Uninitialized, a prover absent from the manifest and no checker all give true (a verify_all error cannot occur: it only returns Ok, solver_integrity.rs:164-209). So the hypothesis of failed-integrity-level1 (Dispatch.agda:68) is almost never reachable. +* Dispatch.agda models 'the full trust-hardening pipeline' (Dispatch.agda:6), but most entry points bypass it and call ProverBackend::verify_proof directly: src/rust/cli/verify.rs:36-40, src/rust/server/verify.rs:81-84, src/interfaces/rest/handlers.rs:206, src/interfaces/grpc/main.rs:250, src/interfaces/graphql/schema.rs:718. The dispatcher is reached only from src/rust/server/verify.rs:117-119 and, under the verisim feature, src/rust/server/prove.rs:36-41. +* Headers claim more than the files state: TrustLevel.agda:8 and 10 ('combining evidence never lowers trust', 'complete'), Dispatch.agda:7-10 (stage order, minimum of all factors, idempotence have no statement), MetaChecker.agda:18, 21 and 44 ('total preorder', 'comment-aware scanning is sound', 'Rejected is detected on either side'), AxiomTrackerCompleteness.agda:4-5 ('every registered axiom is tracked'). +* Adjacent counterparts are also off the Rust and should not count as evidence: verification/proofs/lean4/ConfidenceLattice.lean:152-160 keeps the pre-#477 Level5 rule while saying it mirrors confidence.rs exactly; src/abi/EchidnaABI/Types.idr:385 gives TrustLevel a sixth constructor Untrusted, where the Rust enum is 1..=5 (lib.rs:94-105). + +=== Open questions + +* min-trust-lb-left/right (TrustLevel.agda:154, 177): reading A (kept), min_level and combine_trust are shipped public functions with written contracts, so the home is rust; reading B (review), nothing calls them in echidna or echidnabot, so the statements model behaviour the Rust lacks and retire. The source cannot say whether the owner wants the uncalled functions proved or deleted; if deleted, both rows become retire with successor 'none'. +* empty-registry-clean (AxiomTrackerCompleteness.agda:101): reading A (used), keep the fail-open behaviour and state it as an explicit contract on scan; reading B, a prover with no pattern table should fail closed, and then the statement retires and the contract is the opposite one. This is an owner decision; it matters most for Metamath, HOLLight, Twelf, Nuprl and Minlog. +* Portfolio.agda:8 under Bayesian / DempsterShafer: reading A, a defect, since dispatch.rs:894-898 says a conclusive disagreement always vetoes; reading B, by design, since the ArbitrationPolicy doc (result_arbiter.rs:153-155) says a verdict is always ranked and only needs_review is set. The row's contract assumes reading A. The case was computed by hand from source, not run. +* inconclusive-is-level1 and timeout-is-level1 (Portfolio.agda:68, 77): retired because the Rust does the opposite. Whether a disagreement or an all-timed-out result should force Level1 is an owner decision; if yes, it is a new contract on dispatch, not on the kernel. +* Label for definitional statements whose intent is a clause of a Rust contract: reading A (used), rust only when the row is the carrier of that clause, retire with the contract as successor when another row carries it; reading B, every such row is rust. It changes counts only (opposite-verdict-disagree, agree-refl-valid, agree-refl-invalid, the four *-maps-to-*, single-reject-detected, add-rejected-entry-makes-rejected, cap-monotonic), not the set of obligations. +* The five join laws and fold-worst-++ were retired as library instances. Whether mathesis should state the bounded-chain laws once, generically, and so cover this chain as well as the §5 tokens is an extension of ruling D-10 that only the owner can make. Likewise which repository owns the receipt/warrant theory (epistemic-types, echidnabot or echidna). +* Evidence limits: this judgment read the sources and ran nothing. The reviewer's probe results (2400 kernel inputs, counts 0..=4) and the colleague's kernel scanner run were not repeated; defects on the cross-checked path, the shipped scanner and the Bayesian case are source readings. Each needs a failing test on the shipped code before a contract is written. + +== R3: Lean 4 corpus + +_Files:_ `verification/proofs/lean4/ConfidenceLattice.lean`, `verification/proofs/lean4/ParetoMaximality.lean`, `verification/proofs/lean4/ParetoStrongMaximality.lean`, `verification/proofs/lean4/PortfolioCompleteness.lean` + +[cols="2,3,1,2,4,3",options="header"] +|=== +|Statement |Says |Home |Rust target |Obligation or successor |Why +|`verification/proofs/lean4/ConfidenceLattice.lean:62` + +TrustLevel.value_injective |Two trust levels with the same numeric value are the same level. |`idris2` |— |The TrustLevel numeric code is injective, lies in 1..=5 and is the same code on every seam: the JSON `trust_level` field (src/rust/server/verify.rs:127, which casts the discriminant and bypasses value()), the Cap'n Proto `trustLevel :UInt8` fields (schemas/echidna.capnp:32, crates/echidna-wire/schemas) and EchidnaABI.Types.trustLevelToNat (src/abi/EchidnaABI/Types.idr:395, which today has an extra Untrusted = 0). |Changed by the review dispute. Injectivity matters only where the code is decoded, and the code crosses a shipped seam (verify.rs:127) that a contract on value() does not cover. The Rust half of the split (exact table on value()) is carried by the value_pos and value_le_5 rows. +|`verification/proofs/lean4/ConfidenceLattice.lean:67` + +TrustLevel.le_refl |The model order (defined as value a ≤ value b) is reflexive. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (PartialOrd/Ord)` |The Rust order on TrustLevel agrees with the level table: a <= b iff lvl(a) <= lvl(b). The order is `#[derive(PartialOrd, Ord)]` (lib.rs:91-93), so there is no body to annotate: either hand-write PartialOrd/Ord in the kernel and prove the agreement with Creusot/Pearlite and Verus, or keep the derive and record the agreement as an ASSUMED boundary. Reflexivity, antisymmetry, transitivity, totality, Level1 as bottom, Level5 as top and the chain Level1 < ... < Level5 then follow from integer order. |Order of a Rust enum. The Lean order is defined through value, so the law says nothing about the Rust `<=`. Review dispute upheld on the contract, not the home: the sketched `ensures` on a derived impl cannot be attached. The gate that uses this order is src/rust/dispatch.rs:680 and :1038. +|`verification/proofs/lean4/ConfidenceLattice.lean:71` + +TrustLevel.le_antisymm |The model order is antisymmetric. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (PartialOrd/Ord)` |The Rust order on TrustLevel agrees with the level table: a <= b iff lvl(a) <= lvl(b). The order is `#[derive(PartialOrd, Ord)]` (lib.rs:91-93), so there is no body to annotate: either hand-write PartialOrd/Ord in the kernel and prove the agreement with Creusot/Pearlite and Verus, or keep the derive and record the agreement as an ASSUMED boundary. Reflexivity, antisymmetry, transitivity, totality, Level1 as bottom, Level5 as top and the chain Level1 < ... < Level5 then follow from integer order. |Same block as le_refl. Needs the level table to be injective. +|`verification/proofs/lean4/ConfidenceLattice.lean:75` + +TrustLevel.le_trans |The model order is transitive. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (PartialOrd/Ord)` |The Rust order on TrustLevel agrees with the level table: a <= b iff lvl(a) <= lvl(b). The order is `#[derive(PartialOrd, Ord)]` (lib.rs:91-93), so there is no body to annotate: either hand-write PartialOrd/Ord in the kernel and prove the agreement with Creusot/Pearlite and Verus, or keep the derive and record the agreement as an ASSUMED boundary. Reflexivity, antisymmetry, transitivity, totality, Level1 as bottom, Level5 as top and the chain Level1 < ... < Level5 then follow from integer order. |Same block as le_refl. +|`verification/proofs/lean4/ConfidenceLattice.lean:79` + +TrustLevel.le_total |Any two model levels are comparable. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (PartialOrd/Ord)` |The Rust order on TrustLevel agrees with the level table: a <= b iff lvl(a) <= lvl(b). The order is `#[derive(PartialOrd, Ord)]` (lib.rs:91-93), so there is no body to annotate: either hand-write PartialOrd/Ord in the kernel and prove the agreement with Creusot/Pearlite and Verus, or keep the derive and record the agreement as an ASSUMED boundary. Reflexivity, antisymmetry, transitivity, totality, Level1 as bottom, Level5 as top and the chain Level1 < ... < Level5 then follow from integer order. |Same block as le_refl. +|`verification/proofs/lean4/ConfidenceLattice.lean:98` + +TrustLevel.meet_le_left |The model meet is below its left argument. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::min_level` |min_level(a, b): result <= a, result <= b and result == a \|\| result == b. Already written at lib.rs:141-146, not discharged. It is stated with `<=` on TrustLevel, so it depends on the Ord/table agreement. |Property of one Rust function. The written Rust contract is stronger than the Lean (it gives the greatest lower bound). min_level is reached only through combine_trust, which has no caller in the repo. +|`verification/proofs/lean4/ConfidenceLattice.lean:102` + +TrustLevel.meet_le_right |The model meet is below its right argument. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::min_level` |min_level(a, b): result <= a, result <= b and result == a \|\| result == b. Already written at lib.rs:141-146, not discharged. It is stated with `<=` on TrustLevel, so it depends on the Ord/table agreement. |Same function contract as meet_le_left. +|`verification/proofs/lean4/ConfidenceLattice.lean:106` + +TrustLevel.le_join_left |The model join is above its left argument. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::max_level` |max_level(a, b): result >= a, result >= b and result == a \|\| result == b. Already written at lib.rs:162-167, not discharged. It is stated with `>=` on TrustLevel, so it depends on the Ord/table agreement. |Kept as rust against a low-severity review dispute: max_level has no caller anywhere checked, but it is public API of echidna-core and its contract is already written. Carry or delete with the function is an owner call (see unresolved). +|`verification/proofs/lean4/ConfidenceLattice.lean:110` + +TrustLevel.le_join_right |The model join is above its right argument. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::max_level` |max_level(a, b): result >= a, result >= b and result == a \|\| result == b. Already written at lib.rs:162-167, not discharged. It is stated with `>=` on TrustLevel, so it depends on the Ord/table agreement. |Same function contract as le_join_left; same owner call. +|`verification/proofs/lean4/ConfidenceLattice.lean:116` + +TrustLevel.level1_le_all |Level1 is below every model level. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (PartialOrd/Ord)` |The Rust order on TrustLevel agrees with the level table: a <= b iff lvl(a) <= lvl(b). The order is `#[derive(PartialOrd, Ord)]` (lib.rs:91-93), so there is no body to annotate: either hand-write PartialOrd/Ord in the kernel and prove the agreement with Creusot/Pearlite and Verus, or keep the derive and record the agreement as an ASSUMED boundary. Reflexivity, antisymmetry, transitivity, totality, Level1 as bottom, Level5 as top and the chain Level1 < ... < Level5 then follow from integer order. |Part of the order block. As a postcondition on a function returning TrustLevel (lib.rs:344) it constrains nothing; carry it once as an order fact. +|`verification/proofs/lean4/ConfidenceLattice.lean:120` + +TrustLevel.all_le_level5 |Every model level is below Level5. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (PartialOrd/Ord)` |The Rust order on TrustLevel agrees with the level table: a <= b iff lvl(a) <= lvl(b). The order is `#[derive(PartialOrd, Ord)]` (lib.rs:91-93), so there is no body to annotate: either hand-write PartialOrd/Ord in the kernel and prove the agreement with Creusot/Pearlite and Verus, or keep the derive and record the agreement as an ASSUMED boundary. Reflexivity, antisymmetry, transitivity, totality, Level1 as bottom, Level5 as top and the chain Level1 < ... < Level5 then follow from integer order. |Part of the order block; same remark as level1_le_all. +|`verification/proofs/lean4/ConfidenceLattice.lean:176` + +TrustLevel.reject_implies_level1 |A Reject-level axiom gives Level1 whatever the other factors are. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |ensures(factors.worst_axiom_danger == Reject ==> result == Level1) on the kernel compute_trust_level (written at lib.rs:321-324, not discharged); the wrapper src/rust/verification/confidence.rs::compute_trust_level needs the same clause through its danger mapping. |Property of one Rust function. The first guard is unchanged, so the statement is still true of the Rust, but the Lean proof is about the old function body. +|`verification/proofs/lean4/ConfidenceLattice.lean:183` + +TrustLevel.reject_gives_minimum_trust |A Reject result is below the result for any other factors. |`retire` |— |Successor: reject_implies_level1 together with level1_le_all, both carried to the Rust. |Corollary of two carried statements; it adds nothing and needs no contract of its own. +|`verification/proofs/lean4/ConfidenceLattice.lean:191` + +TrustLevel.warning_implies_level1 |A Warning-level axiom gives Level1. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |ensures(factors.worst_axiom_danger == Warning ==> result == Level1) on the kernel compute_trust_level (written at lib.rs:325-328, not discharged). |Property of one Rust function; second guard unchanged; the Lean proof is about the old body. +|`verification/proofs/lean4/ConfidenceLattice.lean:198` + +TrustLevel.failed_integrity_implies_level1 |A failed integrity check with Safe axioms gives Level1. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |ensures(!factors.solver_integrity_ok ==> result == Level1), unconditional, on the kernel compute_trust_level (written at lib.rs:329, not discharged). |Property of one Rust function. The Lean `Safe` hypothesis is superfluous; the Rust clause is the unconditional form. In dispatch the flag is rarely false (see model gaps). +|`verification/proofs/lean4/ConfidenceLattice.lean:213` + +TrustLevel.adding_prover_monotone |One more confirming prover never lowers the level. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |Give compute_trust_level a logical model: ensures(result == trust_spec(*factors)). Prove one lemma in Pearlite and in Verus: if g has at least the evidence of f (confirming_provers, small_kernel_confirmations, certificate produced and verified, SmallKernel class) and g is capped only if f is, then trust_spec(f) <= trust_spec(g). The +1 instance needs confirming_provers < u32::MAX. |The Lean proof runs over the pre-#477 Level 5 guard, so it is not evidence for the shipped rule. The statement still holds on the current body by reading (both reviewers), not by any machine check. No annotation exists; test tk6 only. +|`verification/proofs/lean4/ConfidenceLattice.lean:235` + +TrustLevel.verifying_cert_monotone |With a certificate present, setting certificate_verified to true never lowers the level. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |Give compute_trust_level a logical model: ensures(result == trust_spec(*factors)). Prove one lemma in Pearlite and in Verus: if g has at least the evidence of f (confirming_provers, small_kernel_confirmations, certificate produced and verified, SmallKernel class) and g is capped only if f is, then trust_spec(f) <= trust_spec(g). The +1 instance needs confirming_provers < u32::MAX. |Stale proof: in the old model the verified flag alone raised a small-kernel result; the Rust now also needs has_certificate. Statement survives on the current rule by reading. +|`verification/proofs/lean4/ConfidenceLattice.lean:256` + +TrustLevel.small_kernel_monotone |Turning is_small_kernel to true never lowers the level. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |Give compute_trust_level a logical model: ensures(result == trust_spec(*factors)). Prove one lemma in Pearlite and in Verus: if g has at least the evidence of f (confirming_provers, small_kernel_confirmations, certificate produced and verified, SmallKernel class) and g is capped only if f is, then trust_spec(f) <= trust_spec(g). The +1 instance needs confirming_provers < u32::MAX. |Stale proof and the only one of the three with no current counterpart, not even a test. The wrapper also needs: class is SmallKernel iff is_small_kernel_prover(prover) (src/rust/verification/confidence.rs:60-85). +|`verification/proofs/lean4/ConfidenceLattice.lean:278` + +TrustLevel.level1_ne_level2 |Level1 and Level2 are different constructors. |`retire` |— |none; implied by the TrustLevel::value table contract |True by definition: constructor disjointness, proved by `decide`. +|`verification/proofs/lean4/ConfidenceLattice.lean:279` + +TrustLevel.level1_ne_level3 |Level1 and Level3 are different constructors. |`retire` |— |none; implied by the TrustLevel::value table contract |True by definition: constructor disjointness, proved by `decide`. +|`verification/proofs/lean4/ConfidenceLattice.lean:280` + +TrustLevel.level1_ne_level4 |Level1 and Level4 are different constructors. |`retire` |— |none; implied by the TrustLevel::value table contract |True by definition: constructor disjointness, proved by `decide`. +|`verification/proofs/lean4/ConfidenceLattice.lean:281` + +TrustLevel.level1_ne_level5 |Level1 and Level5 are different constructors. |`retire` |— |none; implied by the TrustLevel::value table contract |True by definition: constructor disjointness, proved by `decide`. +|`verification/proofs/lean4/ConfidenceLattice.lean:282` + +TrustLevel.level2_ne_level3 |Level2 and Level3 are different constructors. |`retire` |— |none; implied by the TrustLevel::value table contract |True by definition: constructor disjointness, proved by `decide`. +|`verification/proofs/lean4/ConfidenceLattice.lean:283` + +TrustLevel.level2_ne_level4 |Level2 and Level4 are different constructors. |`retire` |— |none; implied by the TrustLevel::value table contract |True by definition: constructor disjointness, proved by `decide`. +|`verification/proofs/lean4/ConfidenceLattice.lean:284` + +TrustLevel.level2_ne_level5 |Level2 and Level5 are different constructors. |`retire` |— |none; implied by the TrustLevel::value table contract |True by definition: constructor disjointness, proved by `decide`. +|`verification/proofs/lean4/ConfidenceLattice.lean:285` + +TrustLevel.level3_ne_level4 |Level3 and Level4 are different constructors. |`retire` |— |none; implied by the TrustLevel::value table contract |True by definition: constructor disjointness, proved by `decide`. +|`verification/proofs/lean4/ConfidenceLattice.lean:286` + +TrustLevel.level3_ne_level5 |Level3 and Level5 are different constructors. |`retire` |— |none; implied by the TrustLevel::value table contract |True by definition: constructor disjointness, proved by `decide`. +|`verification/proofs/lean4/ConfidenceLattice.lean:287` + +TrustLevel.level4_ne_level5 |Level4 and Level5 are different constructors. |`retire` |— |none; implied by the TrustLevel::value table contract |True by definition: constructor disjointness, proved by `decide`. +|`verification/proofs/lean4/ConfidenceLattice.lean:293` + +TrustLevel.level1_lt_level2 |Level1 is strictly below Level2 in the model order. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (PartialOrd/Ord)` |The Rust order on TrustLevel agrees with the level table: a <= b iff lvl(a) <= lvl(b). The order is `#[derive(PartialOrd, Ord)]` (lib.rs:91-93), so there is no body to annotate: either hand-write PartialOrd/Ord in the kernel and prove the agreement with Creusot/Pearlite and Verus, or keep the derive and record the agreement as an ASSUMED boundary. Reflexivity, antisymmetry, transitivity, totality, Level1 as bottom, Level5 as top and the chain Level1 < ... < Level5 then follow from integer order. |The chain fixes the direction of the derived order, which the Lean takes for granted. Today a doc-comment stub and test po1 only (lib.rs:432-445). +|`verification/proofs/lean4/ConfidenceLattice.lean:295` + +TrustLevel.level2_lt_level3 |Level2 is strictly below Level3. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (PartialOrd/Ord)` |The Rust order on TrustLevel agrees with the level table: a <= b iff lvl(a) <= lvl(b). The order is `#[derive(PartialOrd, Ord)]` (lib.rs:91-93), so there is no body to annotate: either hand-write PartialOrd/Ord in the kernel and prove the agreement with Creusot/Pearlite and Verus, or keep the derive and record the agreement as an ASSUMED boundary. Reflexivity, antisymmetry, transitivity, totality, Level1 as bottom, Level5 as top and the chain Level1 < ... < Level5 then follow from integer order. |Same chain as level1_lt_level2. +|`verification/proofs/lean4/ConfidenceLattice.lean:297` + +TrustLevel.level3_lt_level4 |Level3 is strictly below Level4. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (PartialOrd/Ord)` |The Rust order on TrustLevel agrees with the level table: a <= b iff lvl(a) <= lvl(b). The order is `#[derive(PartialOrd, Ord)]` (lib.rs:91-93), so there is no body to annotate: either hand-write PartialOrd/Ord in the kernel and prove the agreement with Creusot/Pearlite and Verus, or keep the derive and record the agreement as an ASSUMED boundary. Reflexivity, antisymmetry, transitivity, totality, Level1 as bottom, Level5 as top and the chain Level1 < ... < Level5 then follow from integer order. |Same chain as level1_lt_level2. +|`verification/proofs/lean4/ConfidenceLattice.lean:299` + +TrustLevel.level4_lt_level5 |Level4 is strictly below Level5. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel (PartialOrd/Ord)` |The Rust order on TrustLevel agrees with the level table: a <= b iff lvl(a) <= lvl(b). The order is `#[derive(PartialOrd, Ord)]` (lib.rs:91-93), so there is no body to annotate: either hand-write PartialOrd/Ord in the kernel and prove the agreement with Creusot/Pearlite and Verus, or keep the derive and record the agreement as an ASSUMED boundary. Reflexivity, antisymmetry, transitivity, totality, Level1 as bottom, Level5 as top and the chain Level1 < ... < Level5 then follow from integer order. |Same chain as level1_lt_level2. +|`verification/proofs/lean4/PortfolioCompleteness.lean:142` + +EchidnaPortfolio.reconcile_cons |When the completed list is first :: rest, the model reconcile equals its own if-then-else body. |`retire` |— |none |True by definition: an unfolding lemma (`unfold reconcile; rw`) needed only by the Lean tactics. +|`verification/proofs/lean4/PortfolioCompleteness.lean:166` + +EchidnaPortfolio.reconcile_nil |When the completed list is empty, the model reconcile equals its AllTimedOut record. |`retire` |— |Successor: PR-2, PR-3 and PR-4, all carried to the Rust. |True by definition: an unfolding lemma; its content is in PR-2 to PR-4. +|`verification/proofs/lean4/PortfolioCompleteness.lean:179` + +EchidnaPortfolio.reconcile_exhaustive (PR-1) |The confidence of a reconcile result is one of the four constructors. |`retire` |— |none |True of every value of a four-constructor type; it does not depend on reconcile at all. +|`verification/proofs/lean4/PortfolioCompleteness.lean:197` + +EchidnaPortfolio.allTimedOut_iff_no_completed (PR-2) |The model returns AllTimedOut exactly when no input result has a verdict. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile, with done = the results whose verified is Some, in order: confidence is AllTimedOut iff done is empty, SingleSolver iff done has exactly one entry, CrossChecked iff done has two or more entries with equal verdicts, Inconclusive iff two entries of done differ. |Property of one shipped Rust function; the Lean model follows the current body branch for branch. No Creusot or Verus statement about reconcile exists. +|`verification/proofs/lean4/PortfolioCompleteness.lean:214` + +EchidnaPortfolio.allTimedOut_verdict (PR-3) |An AllTimedOut result carries no verdict. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile, with done = the results whose verified is Some, in order: verified is None when confidence is AllTimedOut or Inconclusive, and equals done[0].verified when it is SingleSolver or CrossChecked; the unwraps at portfolio.rs:128 and :133 do not panic. |Property of one shipped Rust function. +|`verification/proofs/lean4/PortfolioCompleteness.lean:222` + +EchidnaPortfolio.allTimedOut_needs_review (PR-4) |An AllTimedOut result is flagged for review. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile: needs_review == (confidence is Inconclusive or AllTimedOut). |Property of one shipped Rust function; one half of PR-13. +|`verification/proofs/lean4/PortfolioCompleteness.lean:248` + +EchidnaPortfolio.singleSolver_implies_one_completed (PR-5) |A SingleSolver result means exactly one input had a verdict (one direction only). |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile, with done = the results whose verified is Some, in order: confidence is AllTimedOut iff done is empty, SingleSolver iff done has exactly one entry, CrossChecked iff done has two or more entries with equal verdicts, Inconclusive iff two entries of done differ. |Property of one shipped Rust function. The Lean proves one direction although its header claims an iff; the Rust contract states the iff. +|`verification/proofs/lean4/PortfolioCompleteness.lean:275` + +EchidnaPortfolio.crossChecked_implies_two_completed (PR-6) |A CrossChecked result means at least two inputs had a verdict. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile, with done = the results whose verified is Some, in order: confidence is AllTimedOut iff done is empty, SingleSolver iff done has exactly one entry, CrossChecked iff done has two or more entries with equal verdicts, Inconclusive iff two entries of done differ. |Property of one shipped Rust function. 'Two' means two result entries, not two distinct provers: neither model nor Rust deduplicates by prover. +|`verification/proofs/lean4/PortfolioCompleteness.lean:292` + +EchidnaPortfolio.crossChecked_has_verdict (PR-7) |A CrossChecked result carries a definite verdict. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile, with done = the results whose verified is Some, in order: verified is None when confidence is AllTimedOut or Inconclusive, and equals done[0].verified when it is SingleSolver or CrossChecked; the unwraps at portfolio.rs:128 and :133 do not panic. |Property of one shipped Rust function; follows from PR-9. +|`verification/proofs/lean4/PortfolioCompleteness.lean:307` + +EchidnaPortfolio.crossChecked_no_review (PR-8) |A CrossChecked result is not flagged for review. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile: needs_review == (confidence is Inconclusive or AllTimedOut). |Property of one shipped Rust function; part of PR-13. +|`verification/proofs/lean4/PortfolioCompleteness.lean:322` + +EchidnaPortfolio.crossChecked_verdict_matches_first (PR-9) |A CrossChecked verdict equals the verdict of the first completed input. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile, with done = the results whose verified is Some, in order: verified is None when confidence is AllTimedOut or Inconclusive, and equals done[0].verified when it is SingleSolver or CrossChecked; the unwraps at portfolio.rs:128 and :133 do not panic. |Property of one shipped Rust function. The Lean writes getD false where the Rust unwraps, so it cannot state panic-freedom; the Rust contract must. +|`verification/proofs/lean4/PortfolioCompleteness.lean:341` + +EchidnaPortfolio.inconclusive_implies_disagreement (PR-10) |An Inconclusive result means two completed inputs returned different verdicts (one direction only). |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile, with done = the results whose verified is Some, in order: confidence is AllTimedOut iff done is empty, SingleSolver iff done has exactly one entry, CrossChecked iff done has two or more entries with equal verdicts, Inconclusive iff two entries of done differ. |Property of one shipped Rust function. One direction only in Lean; the header claims an iff. +|`verification/proofs/lean4/PortfolioCompleteness.lean:390` + +EchidnaPortfolio.inconclusive_needs_review (PR-11) |An Inconclusive result is flagged for review. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile: needs_review == (confidence is Inconclusive or AllTimedOut). |Property of one shipped Rust function; part of PR-13. +|`verification/proofs/lean4/PortfolioCompleteness.lean:403` + +EchidnaPortfolio.inconclusive_no_verdict (PR-12) |An Inconclusive result carries no verdict. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile, with done = the results whose verified is Some, in order: verified is None when confidence is AllTimedOut or Inconclusive, and equals done[0].verified when it is SingleSolver or CrossChecked; the unwraps at portfolio.rs:128 and :133 do not panic. |Property of one shipped Rust function; the safety clause (a disagreement never yields a verdict). +|`verification/proofs/lean4/PortfolioCompleteness.lean:421` + +EchidnaPortfolio.needs_review_iff_no_consensus (PR-13) |The review flag is set exactly when the result is Inconclusive or AllTimedOut. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile: needs_review == (confidence is Inconclusive or AllTimedOut). |Property of one shipped Rust function; subsumes PR-4, PR-8 and PR-11. +|`verification/proofs/lean4/PortfolioCompleteness.lean:457` + +EchidnaPortfolio.unanimous_yields_crosschecked (PR-14) |If at least two inputs completed and all returned the same verdict b, the result is CrossChecked with verdict b. |`rust` |`src/rust/verification/portfolio.rs::PortfolioSolver::reconcile` |On reconcile, with done = the results whose verified is Some, in order: confidence is AllTimedOut iff done is empty, SingleSolver iff done has exactly one entry, CrossChecked iff done has two or more entries with equal verdicts, Inconclusive iff two entries of done differ. |Property of one shipped Rust function; the converse half of the CrossChecked iff. Its verdict part is in the PR-9 clause. Its docstring still says the proof may not build; that comment is out of date. +|`verification/proofs/lean4/ParetoMaximality.lean:71` + +EchidnaPareto.TrustLevel.value_pos |In a second Lean copy of TrustLevel (L1..L5), value is at least 1. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::value` |TrustLevel::value returns the exact table: Level1..Level5 map to 1..5 (a logical `lvl` with ensures(result@ == lvl(self))), which gives the range 1..=5. Today only the range is written (lib.rs:127) and it is not discharged. |Range of one Rust function; weighted_rank divides it by 5.0 and dominates compares it. Unused by any later Lean theorem. The cross-seam facet of the same table is the idris2 row value_injective (review dispute). +|`verification/proofs/lean4/ParetoMaximality.lean:74` + +EchidnaPareto.TrustLevel.value_le_5 |In the second Lean copy, value is at most 5. |`rust` |`crates/echidna-core-creusot/src/lib.rs::TrustLevel::value` |TrustLevel::value returns the exact table: Level1..Level5 map to 1..5 (a logical `lvl` with ensures(result@ == lvl(self))), which gives the range 1..=5. Today only the range is written (lib.rs:127) and it is not discharged. |Same as value_pos. Also stated on the six-constructor Idris type as trustLevel5IsMax (src/abi/EchidnaABI/Types.idr:414). +|`verification/proofs/lean4/ParetoMaximality.lean:131` + +EchidnaPareto.dominates_irreflexive (PO-1) |No objective tuple dominates itself. |`agda-theory` |— |Agda, generic in the axes: the strict part of a product of preorders (at least as good on every axis, strictly better on one) is irreflexive and transitive, hence asymmetric. Separate Rust leg: the shipped private ParetoFrontier::dominates (src/rust/verification/pareto.rs:75) needs the definitional contract result == dominates_spec(a, b), and any Rust proof that uses irreflexivity or transitivity must prove them again over dominates_spec in Pearlite and in Verus. |Order theory true of any implementation, so the home stays Agda. Review dispute upheld in part: the Rust leg is added, because the cited contract sits on a kernel copy nothing calls (crates/echidna-core-creusot/src/pareto.rs:118-150) and an Agda theorem does not transfer to the Rust verifiers. +|`verification/proofs/lean4/ParetoMaximality.lean:138` + +EchidnaPareto.dominates_antisymmetric (PO-2) |If a dominates b then b does not dominate a. |`agda-theory` |— |Agda, generic in the axes: the strict part of a product of preorders (at least as good on every axis, strictly better on one) is irreflexive and transitive, hence asymmetric. Separate Rust leg: the shipped private ParetoFrontier::dominates (src/rust/verification/pareto.rs:75) needs the definitional contract result == dominates_spec(a, b), and any Rust proof that uses irreflexivity or transitivity must prove them again over dominates_spec in Pearlite and in Verus. |Same module as PO-1. Misnamed: this is asymmetry, a corollary of PO-1 and PO-3. +|`verification/proofs/lean4/ParetoMaximality.lean:150` + +EchidnaPareto.dominates_transitive (PO-3) |Dominance is transitive. |`agda-theory` |— |Agda, generic in the axes: the strict part of a product of preorders (at least as good on every axis, strictly better on one) is irreflexive and transitive, hence asymmetric. Separate Rust leg: the shipped private ParetoFrontier::dominates (src/rust/verification/pareto.rs:75) needs the definitional contract result == dominates_spec(a, b), and any Rust proof that uses irreflexivity or transitivity must prove them again over dominates_spec in Pearlite and in Verus. |Same module as PO-1; needed by strong maximality (PO-12). +|`verification/proofs/lean4/ParetoMaximality.lean:209` + +EchidnaPareto.frontier_sound (PO-4) |Every member of `cs.filter isPareto` satisfies isPareto. |`rust` |`src/rust/verification/pareto.rs::ParetoFrontier::compute` |On the shipped compute: after the call, candidates[i].is_pareto_optimal holds iff no other index j has dominates(candidates[j], candidates[i]), and every returned index is flagged. |In Lean it is List.mem_filter: the frontier is defined as the filter, so it says nothing about the Rust loop. The property is real on the shipped function; the existing annotations are on a parallel copy (crates/echidna-core-creusot/src/pareto.rs:185-210), not on what meta_controller.rs calls. +|`verification/proofs/lean4/ParetoMaximality.lean:219` + +EchidnaPareto.frontier_subset (PO-5) |Every member of the filter is a member of the input list. |`rust` |`src/rust/verification/pareto.rs::ParetoFrontier::compute` |On the shipped compute: the length, objectives and id of every candidate are unchanged, and every returned index is in bounds. |The other half of List.mem_filter in Lean. The Rust content is different and real: indices in bounds, and compute changes only the flag. +|`verification/proofs/lean4/ParetoMaximality.lean:228` + +EchidnaPareto.frontier_complete (PO-6) |Every input member satisfying isPareto is in the filter. |`rust` |`src/rust/verification/pareto.rs::ParetoFrontier::compute` |On the shipped compute: every flagged index is in the returned vector, and the vector is strictly ascending. This clause is missing from the existing annotations. |List.mem_filter again in Lean. On the Rust it is a real gap: src/rust/agent/meta_controller.rs:639 selects with frontier.contains(i), so the caller relies on the returned vector being complete. +|`verification/proofs/lean4/ParetoMaximality.lean:243` + +EchidnaPareto.frontier_or_dominated (PO-7) |Every input member is in the filter or is dominated by some input member. |`retire` |— |Successor: PO-12 (strong maximality), where it becomes an internal step for a decidable relation; on the Rust it is immediate from the flag clause of compute (PO-4). |Excluded middle over the predicate that defines the filter. The review notes it is a step of the PO-12 proof; it survives there as a lemma, not as a statement of its own. +|`verification/proofs/lean4/ParetoMaximality.lean:260` + +EchidnaPareto.best_time_on_frontier (PO-8) |A candidate with strictly the smallest proof time among differing candidates is on the frontier. |`agda-theory` |— |Agda, generic in the axis: an element strictly best on one coordinate of a product order is undominated. One lemma replaces PO-8 to PO-11. No Rust contract of its own. |Holds for any implementation. On the Rust it would follow from the flag clause and the dominates contract. +|`verification/proofs/lean4/ParetoMaximality.lean:276` + +EchidnaPareto.best_trust_on_frontier (PO-9) |A candidate with strictly the highest trust value is on the frontier. |`agda-theory` |— |Agda, generic in the axis: an element strictly best on one coordinate of a product order is undominated. One lemma replaces PO-8 to PO-11. No Rust contract of its own. |Instance (trust axis, order reversed) of the axis-generic lemma. The shipped caller gives every candidate one default trust, so the hypothesis cannot hold there. +|`verification/proofs/lean4/ParetoMaximality.lean:291` + +EchidnaPareto.best_memory_on_frontier (PO-10) |A candidate with strictly the smallest memory is on the frontier. |`agda-theory` |— |Agda, generic in the axis: an element strictly best on one coordinate of a product order is undominated. One lemma replaces PO-8 to PO-11. No Rust contract of its own. |Instance of the axis-generic lemma. The shipped caller sets memory_bytes to 0 for every candidate (meta_controller.rs:628). +|`verification/proofs/lean4/ParetoMaximality.lean:306` + +EchidnaPareto.best_steps_on_frontier (PO-11) |A candidate with strictly the fewest proof steps is on the frontier. |`agda-theory` |— |Agda, generic in the axis: an element strictly best on one coordinate of a product order is undominated. One lemma replaces PO-8 to PO-11. No Rust contract of its own. |Instance of the axis-generic lemma. The shipped caller sets proof_steps to 0 for every candidate (meta_controller.rs:629). +|`verification/proofs/lean4/ParetoMaximality.lean:352` + +EchidnaPareto.domSet_subset_of_dominates (PD-1) |If b dominates a, every dominator of b in cs is a dominator of a in cs. |`agda-theory` |— |Agda, generic in the relation: in a finite list under a decidable, irreflexive, transitive relation, every non-maximal element is below a maximal one; corollary: a non-empty list has a maximal element. State it without Nodup. PD-1, PD-2 and PD-3 are its internal steps. It does not transfer to the Rust: strong maximality of compute is either a separate inductive Pearlite lemma and Verus proof fn, or stays `argued`. |Generic (transitivity); an internal lemma of the strong-maximality proof. +|`verification/proofs/lean4/ParetoMaximality.lean:366` + +EchidnaPareto.domSet_strict_witness (PD-2) |If b in cs dominates a, then b is a dominator of a and not a dominator of itself. |`agda-theory` |— |Agda, generic in the relation: in a finite list under a decidable, irreflexive, transitive relation, every non-maximal element is below a maximal one; corollary: a non-empty list has a maximal element. State it without Nodup. PD-1, PD-2 and PD-3 are its internal steps. It does not transfer to the Rust: strong maximality of compute is either a separate inductive Pearlite lemma and Verus proof fn, or stays `argued`. |Generic (irreflexivity plus the hypothesis); an internal lemma of the strong-maximality proof. +|`verification/proofs/lean4/ParetoStrongMaximality.lean:53` + +EchidnaPareto.List.length_lt_of_subset_with_witness |For duplicate-free lists, a subset that misses one element of the other list is strictly shorter. |`retire` |— |none; the Agda proof of PO-12 should compare filter lengths and not port this lemma |A general list lemma hand-rolled because the build has no Mathlib; nothing about the system. It is what forces the unneeded Nodup hypothesis onto PD-3 and PO-12. +|`verification/proofs/lean4/ParetoStrongMaximality.lean:116` + +EchidnaPareto.domCount_strictly_decreases (PD-3) |For a duplicate-free cs, if b in cs dominates a then b has strictly fewer dominators in cs than a. |`agda-theory` |— |Agda, generic in the relation: in a finite list under a decidable, irreflexive, transitive relation, every non-maximal element is below a maximal one; corollary: a non-empty list has a maximal element. State it without Nodup. PD-1, PD-2 and PD-3 are its internal steps. It does not transfer to the Rust: strong maximality of compute is either a separate inductive Pearlite lemma and Verus proof fn, or stays `argued`. |Generic descent measure. Nodup is not needed (both dominator lists are filters of one list, one predicate implying the other) and is false of shipped input. The docstring's reason for it is wrong: the Lean list holds values, not indices. +|`verification/proofs/lean4/ParetoStrongMaximality.lean:144` + +EchidnaPareto.dominated_by_frontier_member (PO-12) |For a duplicate-free cs, every input member not on the frontier is dominated by some frontier member. |`agda-theory` |— |Agda, generic in the relation: in a finite list under a decidable, irreflexive, transitive relation, every non-maximal element is below a maximal one; corollary: a non-empty list has a maximal element. State it without Nodup. PD-1, PD-2 and PD-3 are its internal steps. It does not transfer to the Rust: strong maximality of compute is either a separate inductive Pearlite lemma and Verus proof fn, or stays `argued`. |Holds for any finite strict partial order. Review dispute upheld on the Rust half: the colleague's 'derived ensures' does not follow from the flag clause by SMT; it needs the same well-founded descent (ParetoStrongMaximality.lean:150-172) written again on the Rust side. Home unchanged. +|=== + +=== Model gaps + +* ConfidenceLattice.computeTrustLevel is the pre-#477 rule, though its docstring says it mirrors the Rust exactly (verification/proofs/lean4/ConfidenceLattice.lean:150-168). The kernel (crates/echidna-core-creusot/src/lib.rs:346-399) needs has_certificate for Levels 4 and 5 and min(small_kernel_confirmations, confirming_provers) >= 2 for Level 5. With integrity ok, Safe axioms and a small kernel: cp=2, verified, no certificate gives Lean Level5 but Rust Level3; cp=1, verified, no certificate gives Lean Level4 but Rust Level2; cp=2, certificate, verified, small_kernel_confirmations=1 gives Lean Level5 but Rust Level4. +* The Lean TrustFactors has no small_kernel_confirmations field and a free Bool is_small_kernel (ConfidenceLattice.lean:136-148). The Rust has ProverClass in the kernel, derived from ProverKind by a twelve-prover table in the wrapper (src/rust/verification/confidence.rs:60-85). The wrapper and the table are unmodelled. +* The Lean order on TrustLevel is defined as value a ≤ value b (ConfidenceLattice.lean:46-52). The Rust order is the derived Ord (crates/echidna-core-creusot/src/lib.rs:91-93). Nothing states that the two agree, so the Lean order laws are facts about Nat, not about the Rust `<=` used by the minimum-trust gate (src/rust/dispatch.rs:680, :1038). +* Levels 4 and 5 are modelled but no shipped caller can reach them: all three dispatch call sites pass has_certificate false, certificate_verified false and small_kernel_confirmations 0 (src/rust/dispatch.rs:666-669, 875-878, 1026-1029). Shipped dispatch returns only Level1, Level2 or Level3. +* The integrity cap's hypothesis is rarely reachable: solver_integrity_ok is true when no checker is configured, when the prover is not in the manifest and when the status is Uninitialized (verify_all cannot fail: its only return is Ok, solver_integrity.rs:164-209, so the unwrap_or_default is dead) (src/rust/dispatch.rs:648-662, and the same pattern before :875 and :1026). +* Lean uses Nat; the Rust uses u32, u64, usize and u8. adding_prover_monotone adds 1 with no overflow (ConfidenceLattice.lean:213-215); on the Rust it needs confirming_provers < u32::MAX. +* The meet and join theorems (ConfidenceLattice.lean:98-110) describe min_level and max_level (crates/echidna-core-creusot/src/lib.rs:147, :168). max_level, clamp_trust and combine_trust have no caller in src/ or crates/ outside the kernel crate and its tests; min_level is reached only through combine_trust. +* The written postcondition `result >= Level1 && result <= Level5` on compute_trust_level (crates/echidna-core-creusot/src/lib.rs:344), like Lean level1_le_all and all_le_level5 (ConfidenceLattice.lean:116, :120), is true of every value of the type and constrains the function not at all. +* Portfolio model writes `first.verified.getD false` (verification/proofs/lean4/PortfolioCompleteness.lean:108) where the Rust calls unwrap twice (src/rust/verification/portfolio.rs:128, :133); panic-freedom is not modelled. The model also drops solver_results and proves nothing about agreeing_solvers / disagreeing_solvers. +* Portfolio `verified = none` is read as 'timed out', but the only shipped caller maps every outcome that is neither Proven nor Refuted to None, including prover errors, system errors and inconsistent premises (src/rust/verification/result_arbiter.rs:325-333). 'AllTimedOut' means 'no definite verdict'. 'Two solvers' means two result entries; neither the model nor the Rust requires distinct provers. +* PortfolioCompleteness header overclaims (PortfolioCompleteness.lean:17-30): the SingleSolver, CrossChecked and Inconclusive iffs are each proved in one direction (PR-5 at :248, PR-6 at :275 with PR-14 at :457, PR-10 at :341), and the header items on agreeing solvers and sticky disagreement have no theorem. +* ParetoMaximality.frontier is defined as a filter by isPareto (verification/proofs/lean4/ParetoMaximality.lean:192-201). It is a specification, not a model of the loop in ParetoFrontier::compute (src/rust/verification/pareto.rs:50-72: nested index loops, continue, break, flag mutation, index vector). PO-4, PO-5, PO-6 are List.mem_filter and PO-7 is excluded middle. +* PD-3 and PO-12 assume cs.Nodup over objective values (verification/proofs/lean4/ParetoStrongMaximality.lean:117, :145). Shipped input breaks it on the cold-start path: every candidate without statistics gets the same tuple (src/rust/agent/meta_controller.rs:614-631). The hypothesis is also unnecessary. +* The four-axis theorems (PO-8 to PO-11, ParetoMaximality.lean:260-306) describe axes the shipped caller does not vary: memory_bytes and proof_steps are the constant 0 and trust_level is one default for all candidates (src/rust/agent/meta_controller.rs:621-630). +* The Creusot-annotated Pareto module is a parallel copy, not what ships (crates/echidna-core-creusot/src/pareto.rs:118-150 dominates, :210 compute). The shipped code is src/rust/verification/pareto.rs:50 and :75 (dominates private, unannotated) and does not delegate; proof_steps is u64 in the copy (:78) and usize in the shipped type (:24); weighted_rank differs in signature, formula and return type (copy :324, shipped :97). reconcile has no kernel counterpart. +* Two unrelated Lean models of TrustLevel exist (ConfidenceLattice.lean:27 Level1..Level5, ParetoMaximality.lean:53 L1..L5). The Idris ABI type has six constructors with Untrusted = 0 (src/abi/EchidnaABI/Types.idr:385-401); the Rust enum has five and no zero. +* The trust code crosses a shipped seam no proof mentions: the /api/verify_parallel JSON response writes `result.trust_level as u8` (src/rust/server/verify.rs:127), bypassing value(). The Cap'n Proto trustLevel :UInt8 fields (schemas/echidna.capnp:32, crates/echidna-wire/schemas/proof.capnp:27, prover.capnp:46) have no production writer, only a test literal (crates/echidna-wire/src/lib.rs:91). +* The shipped Pareto caller relies on a property no theorem states: a non-empty candidate list has a non-empty frontier. It falls back to index 0 otherwise (src/rust/agent/meta_controller.rs:634-642). weighted_rank (f64 scores) has no statement at all (src/rust/verification/pareto.rs:97). +* The old rule that ConfidenceLattice models may still be the rule echidnabot runs: echidnabot/src/trust/confidence.rs:179-187 calls echidna_core::trust::compute_trust_level with a TrustFactors literal that has no small_kernel_confirmations field, against the pin at echidnabot/Cargo.toml:35 (inferred from the literal; the pinned commit is not in the local echidna clone). + +=== Open questions + +* Order on TrustLevel: (a) replace `#[derive(PartialOrd, Ord)]` with a hand-written impl in the kernel and prove it agrees with the level table, or (b) keep the derive and record the agreement as an ASSUMED boundary. Under (b) the ten order rows and the min_level / max_level / clamp_trust contracts rest on an assumption. This is a code decision for the owner. Whether Creusot and Verus accept the derives (PartialOrd, Ord, serde) and `self as u8` at all was not checked with either tool. +* Where reconcile and ParetoFrontier::compute are proved: in the large async main crate (src/rust/verification/portfolio.rs, pareto.rs), or moved into the kernel crate with the main crate delegating, as #477 did for trust. This decides the rust_target of 16 rows (PR-2 to PR-14, PO-4 to PO-6). Not settled from the source; feasibility of pointing either verifier at the main crate is unassessed. +* le_join_left / le_join_right (max_level): kept as rust because max_level is public API of echidna-core with a written contract. The other reading: it has no caller in echidna or in the downstream checkouts (echidnabot, proof-burrower, hypatia, panic-attack, gitbot-fleet), so delete the function and retire both statements. Owner call; the same question touches min_level, combine_trust and clamp_trust. +* Strong maximality (PO-12) on the Rust compute: either write it as a separate inductive Pearlite lemma and Verus proof fn (which also needs irreflexivity and transitivity over dominates_spec), or do not claim it of compute and record the link from the Agda theorem as `argued`. The shipped caller needs only the weaker corollary that a non-empty input has a non-empty frontier. +* TrustLevel code on the seams: the Idris ABI type has Untrusted = 0 and the Rust enum does not. Which side changes (drop Untrusted in Idris, or give the wire code a zero) is an interface decision. Also whether src/rust/server/verify.rs:127 should call value() or the contract should be stated on the discriminants. +* Single-home schema against the reviewer's 'split' verdicts: value_injective is placed in idris2 with the Rust half on the value_pos / value_le_5 rows; PO-1 to PO-3 stay agda-theory with the Rust leg written into the obligation. If the ledger allows two homes per statement, these four rows are the ones to split. +* Where the 11 agda-theory statements live: no Agda source exists for any of them. Mathesis (327e4d2) pins no echidna claim and has nothing on Pareto, but it is the ruled home (D-10) of two open echidna theorems on the token order (docs/reports/audit/echidna-proof-route-2026-11-09.adoc:47-65) and pre-registers a five-element chain statement S-1 (docs/proposals/mathesis-research-programme.adoc:318-356). Whether the generic content of the TrustLevel order laws should be stated once there with TrustLevel as an instance, and whether the Pareto theory goes to mathesis or to echidna's meta-checker, is an owner call. +* echidnabot and the old trust rule: its pinned echidna-core revision 645d7a2 is not in the local clone, so I could not confirm that it predates #477. If it does, 'stale' is true of echidna main only and the Lean model still describes what echidnabot runs. +* PROOF-STATUS R3 says '77 of the 79 theorems' (docs/PROOF-STATUS.adoc:274). In these four files the count is 66; the two extra grep hits at ParetoMaximality.lean:386 and :420 are signatures quoted in docstrings. IntegrityVerification.lean (also R3) is outside this area and is not classified here, so the corrected denominator is not confirmed by this pass. +* Nothing was built or run in this pass (no lake, cargo, Creusot or Verus). Every 'still holds on the current rule' and every contract-satisfied-by-the-body remark is a reading of the source by two reviewers, not a check. + +== Idris 2 verification corpus + +_Files:_ `verification/proofs/idris2/AxiomCompleteness.idr`, `verification/proofs/idris2/AxiomPolicyOrdering.idr`, `verification/proofs/idris2/BasicTotality.idr`, `verification/proofs/idris2/DispatchCorrectness.idr`, `verification/proofs/idris2/DispatchOrdering.idr`, `verification/proofs/idris2/ProofStateSerialisation.idr`, `verification/proofs/idris2/ProverKindInjectivity.idr`, `verification/proofs/idris2/TrustLevelSoundness.idr` + +[cols="2,3,1,2,4,3",options="header"] +|=== +|Statement |Says |Home |Rust target |Obligation or successor |Why +|`verification/proofs/idris2/AxiomCompleteness.idr:171,180,188,197,204,210,222` + +leanDetectionComplete, coqDetectionComplete, agdaDetectionComplete, isabelleDetectionComplete, hol4DetectionComplete, idris2DetectionComplete, fstarDetectionComplete (7) |For each pattern of one prover, the local classify table gives a level in a stated set (Lean, Coq: Warning or Noted; Agda, Idris2: Warning or Reject; Isabelle, F*: Warning; HOL4: Reject). |`rust` |`src/rust/verification/axiom_tracker.rs::AxiomTracker::new` |AxiomTracker::new: ensures the table is exactly the 23 (prover, pattern, level) rows of the source, for exactly the 7 tabled kinds (level_of(result, k, c) == Some(L) per row; nothing else present). AxiomTracker::scan: ensures every returned usage has the table level of its construct (so never Safe), and every non-comment, non-scaffold line that contains a tabled pattern of `prover` yields a usage with that pattern. Dispatch: one pure worst-danger fold with ensures result == max danger_level over usages (Safe when empty), used at dispatch.rs:631, :851 and :997. |Changed from retire by the review. The Level 1 cap fires at Warning as well as Reject (crates/echidna-core-creusot/src/lib.rs:354-362), so the Warning-versus-Noted pins are the ones the trust rule needs, and only these lemmas state them. One exact table contract covers them. +|`verification/proofs/idris2/AxiomCompleteness.idr:238` + +noFalseNegatives |The local 23-entry classify table never returns Safe. |`rust` |`src/rust/verification/axiom_tracker.rs::AxiomTracker::scan` |AxiomTracker::new: ensures the table is exactly the 23 (prover, pattern, level) rows of the source, for exactly the 7 tabled kinds (level_of(result, k, c) == Some(L) per row; nothing else present). AxiomTracker::scan: ensures every returned usage has the table level of its construct (so never Safe), and every non-comment, non-scaffold line that contains a tabled pattern of `prover` yields a usage with that pattern. Dispatch: one pure worst-danger fold with ensures result == max danger_level over usages (Safe when empty), used at dispatch.rs:631, :851 and :997. |Home kept; contract changed by the review. No precondition on enforce_policy: it is total, its SPARK twin has none (spark/axiom_tracker/axiom_tracker.ads:9-10), and no shipped path calls it. The consumer side is scan and the dispatch fold. It still does not prove zero false negatives; see the model gaps. +|`verification/proofs/idris2/AxiomCompleteness.idr:284` + +rejectNeverDowngraded |The eight hand-listed unsound patterns classify as Reject. |`rust` |`src/rust/verification/axiom_tracker.rs::AxiomTracker::scan` |AxiomTracker::new: ensures the table is exactly the 23 (prover, pattern, level) rows of the source, for exactly the 7 tabled kinds (level_of(result, k, c) == Some(L) per row; nothing else present). AxiomTracker::scan: ensures every returned usage has the table level of its construct (so never Safe), and every non-comment, non-scaffold line that contains a tabled pattern of `prover` yields a usage with that pattern. Dispatch: one pure worst-danger fold with ensures result == max danger_level over usages (Safe when empty), used at dispatch.rs:631, :851 and :997. |Home kept; target moved from analyze to scan by the review. analyze has no shipped caller (the scan call sites are dispatch.rs:625, :992 and prove_contract.rs:30). The eight Reject rows match the Rust and are part of the exact table. +|`verification/proofs/idris2/AxiomCompleteness.idr:339` + +countsConsistent (with the eight count constants at :305-335) |4 + 3 + 4 + 2 + 1 + 7 + 2 = 23 over typed-in literals. |`retire` |— |Successor: the exact table contract on AxiomTracker::new, which fixes the per-prover entry counts. |Arithmetic on constants tied to neither the Idris type nor the Rust table. +|`verification/proofs/idris2/AxiomPolicyOrdering.idr:86,91,96,101` + +worstDanger_Clean, worstDanger_Classical, worstDanger_Incomplete, worstDanger_Rejected (4) |worstDanger maps Clean, ClassicalAxioms, IncompleteProof, Rejected to Safe, Noted, Warning, Reject. |`rust` |`src/rust/verification/axiom_tracker.rs::AxiomPolicy::worst_danger` |#[ensures(match *self { AxiomPolicy::Clean => result == DangerLevel::Safe, AxiomPolicy::ClassicalAxioms(_) => result == DangerLevel::Noted, AxiomPolicy::IncompleteProof(_) => result == DangerLevel::Warning, AxiomPolicy::Rejected(_) => result == DangerLevel::Reject })] |Kept. The function exists and matches arm for arm (axiom_tracker.rs:62-69). The review is right that no shipped path calls it; that is a wire-or-delete decision (see unresolved), not a different home. The SPARK twin already has this post (spark/axiom_tracker/axiom_tracker.ads:92-98). +|`verification/proofs/idris2/AxiomPolicyOrdering.idr:121,133,144` + +isAcceptable_sound_fwd, isAcceptable_sound_bwd, notAcceptable_implies_Reject (3) |isAcceptable p holds exactly when worstDanger p is not Reject. |`rust` |`src/rust/verification/axiom_tracker.rs::AxiomPolicy::is_acceptable` |#[ensures(result == (self.worst_danger() != DangerLevel::Reject))], using the worst_danger contract (or a #[logic] twin). |Kept, same reasoning as the worst_danger row: true of a real function that is not on the dispatch path. SPARK twin: spark/axiom_tracker/axiom_tracker.ads:85-86. +|`verification/proofs/idris2/AxiomPolicyOrdering.idr:161,166,171,177` + +danger_order_clean_classical, danger_order_classical_incomplete, danger_order_incomplete_rejected, danger_order_preserved (4) |LTE 0 1, 1 2, 2 3 and 0 3 after unfolding worstDanger and dangerToNat. |`rust` |`src/rust/verification/axiom_tracker.rs::DangerLevel` |Lemma on the shipped enum and on the kernel copy (crates/echidna-core-creusot/src/axiom_tracker.rs, PO-A1): #[ensures(DangerLevel::Safe < DangerLevel::Noted && DangerLevel::Noted < DangerLevel::Warning && DangerLevel::Warning < DangerLevel::Reject)]. On src/rust/verification/confidence.rs::compute_trust_level: the four-arm map between the two enums preserves the order. |Home kept; contract corrected by the review. The shipped DangerLevel has no value() method, so the value() form cannot be stated on it. The 0..3 numbering is the C-ABI encoding and already lives in src/abi/EchidnaABI/AxiomTracker.idr:68-88 (dangerToU8, dangerRoundTrip). +|`verification/proofs/idris2/AxiomPolicyOrdering.idr:205` + +policyLE_danger_mono |For ten hand-listed pairs of a local PolicyLE relation, worstDanger is ordered. |`retire` |— |Successor (Rust, no precondition): AxiomTracker::enforce_policy returns Rejected iff some usage is Reject; else IncompleteProof iff some is Warning; else ClassicalAxioms iff some is Noted; else Clean (empty or all Safe). Same as the SPARK post at spark/axiom_tracker/axiom_tracker.ads:62-80. |PolicyLE exists only in this file and is defined as the pairs it is then proved for; the Rust AxiomPolicy has no order. +|`verification/proofs/idris2/AxiomPolicyOrdering.idr:227,232` + +cleanNotReject, rejectedNotSafe (2) |worstDanger Clean is not Reject; worstDanger (Rejected xs) is not Safe. |`retire` |— |Successor: the worst_danger contract on AxiomPolicy::worst_danger implies both. |Constructor disjointness applied to the definition. +|`verification/proofs/idris2/BasicTotality.idr:23,28,33` + +lenAppend, mapLen, doubleAdd (3) |Length of append, length of map, and double over addition, for local list functions. |`retire` |— |none |Filler by the module's own header; library facts with no echidna consumer. +|`verification/proofs/idris2/DispatchCorrectness.idr:92,101,110` + +smtDispatchCorrect, atpDispatchCorrect, itpDispatchCorrect (3) |If requiredLogic g = L and proverLogic p = L then the two are equal, for three logic families. |`retire` |— |Successor (Rust, not yet written): contracts on src/rust/dispatch.rs::ProverDispatcher::select_prover (:1098), for example content containing "(set-logic" and matching no earlier branch returns ProverKind::Z3. |Each is trans and sym on its own hypotheses. No selection function is in the statement; select_prover appears only in a doc comment. +|`verification/proofs/idris2/DispatchCorrectness.idr:123,127,131,135,139,143` + +higherOrderHasProver, firstOrderHasProver, smtHasProver, linearHasProver, equationalHasProver, constraintHasProver (6) |The local proverLogic table maps some prover to each of six logic families. |`retire` |— |none |Witnesses read off a table that exists only in this file. The Rust has no logic-family notion, and the ABI category table (src/abi/EchidnaABI/Provers.idr:54-84) is a different classification. +|`verification/proofs/idris2/DispatchCorrectness.idr:153,161` + +hoNotSmt, foNotHo (2) |A prover mapped to one logic family is not mapped to another. |`retire` |— |none |True of any function; no dispatch function is in the statement. +|`verification/proofs/idris2/DispatchOrdering.idr:23,26,29,32,35,41` + +integrityBeforeSandbox, sandboxBeforeVerify, verifyBeforeCerts, certsBeforeAxioms, axiomsBeforeConfidence, integrityBeforeConfidence (6) |LT 0 1, 1 2, 2 3, 3 4, 4 5 and 0 5 on numeric literals. |`retire` |— |Successor (Rust, after a code fix): in src/rust/dispatch.rs::verify_proof the integrity check gates the prover run. Today it runs after the prover (PROOF-STATUS R1), so it cannot yet be a contract. |Arithmetic on literals over an unused Stage type; the order named is not the Rust order. +|`verification/proofs/idris2/ProofStateSerialisation.idr:212,200` + +termRoundtrip, termListRoundtrip (2) |For a five-constructor Term model and an S-expression codec defined in the same file, decode after encode returns the term. |`retire` |— |Successor: E12 as an open obligation. (a) Idris 2: round trip over the 15-case Term, Hypothesis, Goal and Context of crates/echidna-wire/schemas/common.capnp, once code converts the core types to that schema. (b) CBOR path (src/rust/proof_encoding.rs:26-35): ASSUMED boundary on serde and ciborium, with a property test over the whole ProofState. (c) Rust: state what the OpenTheory and Dedukti export/import pairs preserve; they are lossy today. |Changed from idris2 by the review. The S-expression codec exists only in this file, so the proof is about a stand-in format; this is the same criterion that retires clamp_monotone. Keeping it as idris2 would leave E12 reading as proven. +|`verification/proofs/idris2/ProofStateSerialisation.idr:302,312,370,401,444,452` + +hypRoundtrip, hypListRoundtrip, goalRoundtrip, goalListRoundtrip, ctxEntryRoundtrip, ctxListRoundtrip (6) |The same decode-after-encode identity for (name, type) hypotheses, a three-field Goal, (name, type) context entries, and lists of each. |`retire` |— |Successor: E12 as an open obligation. (a) Idris 2: round trip over the 15-case Term, Hypothesis, Goal and Context of crates/echidna-wire/schemas/common.capnp, once code converts the core types to that schema. (b) CBOR path (src/rust/proof_encoding.rs:26-35): ASSUMED boundary on serde and ciborium, with a property test over the whole ProofState. (c) Rust: state what the OpenTheory and Dedukti export/import pairs preserve; they are lossy today. |Changed from idris2 by the review, as for the Term row. The model also drops Hypothesis.body and type_info and flattens Context. +|`verification/proofs/idris2/ProofStateSerialisation.idr:536` + +proofStateRoundtrip |For a two-field ProofState model, decode after encode returns the state, over the S-expression codec. |`retire` |— |Successor: E12 as an open obligation. (a) Idris 2: round trip over the 15-case Term, Hypothesis, Goal and Context of crates/echidna-wire/schemas/common.capnp, once code converts the core types to that schema. (b) CBOR path (src/rust/proof_encoding.rs:26-35): ASSUMED boundary on serde and ciborium, with a property test over the whole ProofState. (c) Rust: state what the OpenTheory and Dedukti export/import pairs preserve; they are lossy today. |Changed from idris2 by the review. No schema has a ProofState struct and nothing converts core::ProofState to Cap'n Proto, so the statement binds to nothing real. The exchange paths its header names lose data (src/rust/exchange/opentheory.rs:100-134). +|`verification/proofs/idris2/ProofStateSerialisation.idr:549,558,571` + +termSerialisation, goalSerialisation, proofStateSerialisation (3) |Each packs an encoder, a decoder and a round-trip lemma into a Serialisation record over SExpr. |`retire` |— |none (the Serialisation record type at :80 is a good shape to reuse when E12 is restated over a real wire type) |Packaging of the retired lemmas; nothing consumes the records. +|`verification/proofs/idris2/ProofStateSerialisation.idr:585` + +encodeDecodeJust |The same statement as proofStateRoundtrip, defined as that lemma. |`retire` |— |Successor: E12 as an open obligation. (a) Idris 2: round trip over the 15-case Term, Hypothesis, Goal and Context of crates/echidna-wire/schemas/common.capnp, once code converts the core types to that schema. (b) CBOR path (src/rust/proof_encoding.rs:26-35): ASSUMED boundary on serde and ciborium, with a property test over the whole ProofState. (c) Rust: state what the OpenTheory and Dedukti export/import pairs preserve; they are lossy today. |An alias, by its own doc comment. +|`verification/proofs/idris2/ProofStateSerialisation.idr:599` + +encodeInjective |Two ProofStates with equal S-expression encodings are equal; proved from the round trip. |`retire` |— |none (the generic fact, that an encoder with a Maybe-valued left inverse is injective, is a library fact; it follows in one line from the restated E12 round trip if a consumer needs it) |Changed from agda-theory by the review. The statement is about encodeProofState over the local codec, not generic, and has no consumer; carrying it as theory would need Rocq and Lean legs for nothing. +|`verification/proofs/idris2/ProofStateSerialisation.idr:615` + +batchGoalsRoundtrip |goalListRoundtrip applied to the concatenated goals of a list of ProofStates. |`retire` |— |none |An instance of a lemma that already holds for every list; the batch-goals wire encoding it names does not exist in crates/echidna-wire. +|`verification/proofs/idris2/ProverKindInjectivity.idr:376` + +roundTrip |For a local 107-kind table, decoding the code of a prover kind returns that kind. |`rust` |`src/rust/ffi/mod.rs::kind_from_u8` |With a #[logic] code table (141 rows): kind_to_u8 ensures result == code(kind) and result <= 140; kind_from_u8 ensures Some(k) exactly when code(k) == kind, None otherwise (so None above 140). Each shipped encoder (src/interfaces/graphql/ffi_wrapper.rs::prover_kind_to_ffi, src/interfaces/rest/ffi_wrapper.rs::rest_kind_to_ffi, src/interfaces/grpc/ffi_wrapper.rs::proto_kind_to_ffi) ensures its result is the code of the matching core kind, so kind_from_u8 decodes it back. GraphQL fails this for 60 of 141 kinds today and must be fixed first. |Home kept; target widened by the review. kind_to_u8 has no shipped caller (bench and test only). The codes kind_from_u8 decodes come from the interface encoders, and a proof on kind_to_u8 alone would not see the GraphQL mismatch. +|`verification/proofs/idris2/ProverKindInjectivity.idr:490` + +kindToU8Injective |In the local table, equal codes imply equal prover kinds. |`idris2` |— |In the ABI package, over src/abi/EchidnaABI/Types.idr proverKindToU8: equal codes imply equal kinds (one line from proverKindRoundtrip at :148). That table is the one statement of the prover code assignment; it must cover the kinds the Rust decodes (30 of 141 today), and every other code table is checked against it. Drop the divergent 107-row table here. |Collision-freedom of the code assignment is an ABI fact. The ABI package has the round trip but no injectivity lemma, although its Eq instance compares codes. The review's split is adopted: table in Idris 2, encoders and decoder in Rust. +|`verification/proofs/idris2/ProverKindInjectivity.idr:515` + +discriminantBounded (with the constants proverKindCount :506, maxDiscriminant :510) |Every code in the local table is at most 106. |`rust` |`src/rust/ffi/mod.rs::kind_from_u8` |With a #[logic] code table (141 rows): kind_to_u8 ensures result == code(kind) and result <= 140; kind_from_u8 ensures Some(k) exactly when code(k) == kind, None otherwise (so None above 140). Each shipped encoder (src/interfaces/graphql/ffi_wrapper.rs::prover_kind_to_ffi, src/interfaces/rest/ffi_wrapper.rs::rest_kind_to_ffi, src/interfaces/grpc/ffi_wrapper.rs::proto_kind_to_ffi) ensures its result is the code of the matching core kind, so kind_from_u8 decodes it back. GraphQL fails this for 60 of 141 kinds today and must be fixed first. |A bound on one Rust function's result. The Idris bound (106) is wrong for the Rust, whose largest code is 140. Same contract as roundTrip. +|`verification/proofs/idris2/TrustLevelSoundness.idr:76,80,84,88` + +level2NotAtMost1, level3NotAtMost1, level4NotAtMost1, level5NotAtMost1 (4) |The local predicate AtMostLevel1 has no constructor at TrustLevel2 to TrustLevel5. |`retire` |— |none |Holds by the definition of a predicate declared just above, over a TrustLevel with an Untrusted value the Rust lacks. +|`verification/proofs/idris2/TrustLevelSoundness.idr:146` + +assignTrustRejectAtMost1 |The local assignTrust applied to Reject is TrustLevel1. |`retire` |— |Successor: compute_trust_level: #[ensures(factors.worst_axiom_danger == DangerLevel::Reject ==> result == TrustLevel::Level1)], and the same clause for Warning (text at crates/echidna-core-creusot/src/lib.rs:325-333, never run through Creusot; no Verus text). The same clause on the wrapper src/rust/verification/confidence.rs::compute_trust_level over the shipped DangerLevel. |A closed instance of a clause of the local definition; the same fact as rejectImpliesAtMost1. +|`verification/proofs/idris2/TrustLevelSoundness.idr:157` + +assignTrustMonotone |If d = Reject, assignTrust d is at most assignTrust Warning, that is 1 <= 5. |`retire` |— |Successor (Rust, new): compute_trust_level does not rise when worst_axiom_danger rises with the other factors fixed; the Warning ==> Level1 clause is already written at lib.rs:330-333. |One pair only, and wrong for the Rust: Warning also yields Level1 there (lib.rs:360), while the model gives Warning a ceiling of 5. +|`verification/proofs/idris2/TrustLevelSoundness.idr:174` + +rejectImpliesAtMost1 |If d = Reject, the local assignTrust d is at most TrustLevel1. |`rust` |`crates/echidna-core-creusot/src/lib.rs::compute_trust_level` |compute_trust_level: #[ensures(factors.worst_axiom_danger == DangerLevel::Reject ==> result == TrustLevel::Level1)], and the same clause for Warning (text at crates/echidna-core-creusot/src/lib.rs:325-333, never run through Creusot; no Verus text). The same clause on the wrapper src/rust/verification/confidence.rs::compute_trust_level over the shipped DangerLevel. |This is E4 and the Rust behaves this way; the Idris version holds only by the definition of a local function that is not the Rust one. The kernel crate is shipped code (crates/echidna-core/Cargo.toml:24). +|`verification/proofs/idris2/TrustLevelSoundness.idr:190,202,209,216` + +rejectCannotBeLevel2, rejectCannotBeLevel3, rejectCannotBeLevel4, rejectCannotBeLevel5 (4) |If d = Reject, the local assignTrust d is not TrustLevel2, 3, 4 or 5. |`retire` |— |Successor: compute_trust_level: #[ensures(factors.worst_axiom_danger == DangerLevel::Reject ==> result == TrustLevel::Level1)], and the same clause for Warning (text at crates/echidna-core-creusot/src/lib.rs:325-333, never run through Creusot; no Verus text). The same clause on the wrapper src/rust/verification/confidence.rs::compute_trust_level over the shipped DangerLevel. |Each follows from assignTrust Reject = TrustLevel1 and distinct constructors; on the Rust, result == Level1 implies them. +|`verification/proofs/idris2/TrustLevelSoundness.idr:247,251,255,259` + +noRejectLevel2Witness, noRejectLevel3Witness, noRejectLevel4Witness, noRejectLevel5Witness (4) |The local type SoundnessWitness has no constructor at (Reject, TrustLevel2) to (Reject, TrustLevel5). |`retire` |— |none |Holds by the definition of the type, and no code is indexed by SoundnessWitness. +|=== + +=== Model gaps + +* FAIL LOUD (found while judging; in neither the classification nor the review): the cross-checked dispatch path recomputes trust from the first axiom usage, not the worst. src/rust/dispatch.rs:850-855 reads primary_result.axiom_report, which is usages.first() (dispatch.rs:643-645). A Lean proof with `axiom ` (Noted) on an earlier line than `sorry` (Warning) is capped at Level1 by verify_proof, then verify_proof_cross_checked (called at dispatch.rs:495) replaces the level using Noted, so two confirming provers give Level3. Read from source, not executed. The review cited :851-855 as a max over usages; it is not. +* FAIL LOUD (review, confirmed by script): src/interfaces/graphql/ffi_wrapper.rs::prover_kind_to_ffi (:190) and src/rust/ffi/mod.rs::kind_from_u8 (:386) disagree on 60 of 141 prover kinds. GraphQL sends Lean3=30, TypedWasm=31, SPIN=32, CBMC=33; the decoder reads 30=TypedWasm, 31=SPIN, 32=CBMC, 89=Lean3. Call path: src/interfaces/graphql/resolvers.rs:505-509 to echidna_create_prover (ffi/mod.rs:984). So a request for SPIN creates CBMC. The path is taken when init_ffi succeeds (resolvers.rs:487); not executed. +* The axiom scan covers 7 of 141 prover kinds. AxiomTracker::new (src/rust/verification/axiom_tracker.rs:101-277) tables Lean, Coq, Agda, Isabelle, HOL4, Idris2 and FStar; scan looks patterns up by ProverKind (:282-285). Rocq, CubicalAgda, Lean3, IsabelleZF and every other kind get an empty scan, danger Safe and no trust cap. The same empty list is published as trust.axioms of the echidna.prove.result/1 contract (src/rust/prove_contract.rs:28-33), which echidnabot and proof-burrower consume. AxiomCompleteness is closed over the 7 provers and never models scan. +* The shipped scan skips a whole line when it starts with a comment opener (axiom_tracker.rs:290-309), so `(* note *) Admitted.` is not flagged, and a line containing ECHIDNA_SCAFFOLD_SORRY suppresses a sorry match wherever the marker sits. Neither is in the Idris model, whose headline theorem is named noFalseNegatives. +* AxiomCompleteness.patternString (:144-148) disagrees with the Rust for 5 of 23 strings: "believe-me", "assert-total", "assert-smaller", "unsafe-perform-io", "really_believe-me" against the Rust "believe_me", "assert_total", "assert_smaller", "unsafePerformIO", "really_believe_me" (axiom_tracker.rs:217-241). No theorem uses patternString. The 23 levels do match the Rust. +* AxiomPolicyOrdering matches AxiomPolicy::worst_danger and is_acceptable arm for arm, but no shipped path calls AxiomPolicy, enforce_policy, analyze, worst_danger or is_acceptable. The only callers are tests, fuzz/fuzz_targets/fuzz_axiom_tracker.rs and the feature-gated SPARK cross-check (axiom_tracker.rs:387-397). Dispatch lowers only trust_level and never produces a Rejected value (dispatch.rs:618, :675-680). PolicyLE has no Rust counterpart. +* There are two axiom trackers. Dispatch uses src/rust/verification/axiom_tracker.rs, which has no contracts. The annotated copy, crates/echidna-core-creusot/src/axiom_tracker.rs, is not used by dispatch (only its DangerLevel feeds compute_trust_level, through a hand-written four-arm map at src/rust/verification/confidence.rs:67-72). The shipped DangerLevel has no value() method and no explicit discriminants; the kernel copy has both. +* No Creusot contract in the repository has ever been processed. crates/echidna-core-creusot/Cargo.toml:18 has the creusot dependency commented out and :24 defines an empty feature, while lib.rs:69-70 imports creusot_contracts under that feature. PO-A1 is a doc comment only. There is no Verus text anywhere in this area. So 'already written' means text exists on three targets (TrustLevel::value, clamp_trust, compute_trust_level), not five, and none is checked. +* The header of crates/echidna-core-creusot/src/lib.rs (:14) says the crate is not a runtime dependency. It is: crates/echidna-core/Cargo.toml:24 depends on it and src/rust/verification/confidence.rs:60-83 delegates to it. +* ClampTrustBounds models clamp_trust : Nat -> TrustLevel. The Rust has no number-to-level conversion; its clamp_trust (crates/echidna-core-creusot/src/lib.rs:282) clamps a level into a level range and has no caller outside its own tests. The module has no idempotence lemma. +* TrustLevelSoundness.assignTrust takes only a DangerLevel, where the Rust compute_trust_level takes seven factors. It gives Warning a ceiling of TrustLevel5, where the Rust returns Level1 for Warning (lib.rs:360). Its TrustLevel has an Untrusted value the Rust enum lacks (so does src/abi/EchidnaABI/Types.idr:386). +* DispatchCorrectness: LogicFamily, proverLogic and requiredLogic have no Rust counterpart; the real select_prover (src/rust/dispatch.rs:1098) appears only in a doc comment. The module says its table mirrors EchidnaABI.Provers (:33), but that file has a different classification, proverCategory (src/abi/EchidnaABI/Provers.idr:54-84, with a C integer encoding at :88-94): Metamath, Mizar, PVS, ACL2, TLAPS, Twelf, Imandra, Dafny and Why3 are placed differently. +* DispatchOrdering: the six-stage order (Integrity, Sandbox, Verify, Certs, Axioms, Confidence) is not the Rust order, which is create prover, parse, check, axiom scan, integrity, trust (dispatch.rs:550-679). dispatch.rs has no sandbox or certificate step. Integrity runs after the prover, as PROOF-STATUS R1 records. +* ProofStateSerialisation: the S-expression codec exists only in the Idris file. The model has 5 of the 15 Rust Term constructors and drops Hypothesis.body, type_info, proof_script and metadata. The Rust serialises ProofState with serde and ciborium (src/rust/proof_encoding.rs:26-35). crates/echidna-wire has no ProofState struct and no conversion from the core types. The exchange paths the module header names are first-party Rust and lossy: src/rust/exchange/opentheory.rs:100-134 maps every other constructor to const "echidna_opaque", drops Lambda's param_type, cannot re-read its own app and abs output, renames goals and drops hypotheses (:76-97); they are served by REST (src/interfaces/rest/handlers.rs:677-735). So import(export(s)) == s is false there. +* ProverKindInjectivity models 107 kinds; the Rust enum has 141. By script, 28 of the 107 codes equal src/rust/ffi/mod.rs kind_from_u8 and 79 differ (Lean3 is 13 here, 89 in the Rust). kind_to_u8 and kind_from_u8 agree with each other on all 141 rows, but kind_to_u8 has no shipped caller (benches/proof_benchmarks.rs:311 and the test at ffi/mod.rs:1557 only), and that test lists 105 of the 141 kinds. +* There are at least eight prover-code tables with no check between them: src/rust/ffi/mod.rs (141), src/abi/EchidnaABI/Types.idr:78 (30, agrees with the Rust), src/abi/Types.idr (shadow copy outside the package), this Idris module (107, 79 differ), src/zig_ffi/chapel_ffi_exports.h:28 with chapel_bridge.zig:97 (30, different numbering), src/interfaces/graphql/ffi_wrapper.rs:190 (141, 60 differ), src/interfaces/rest/ffi_wrapper.rs:189 (30, agree), src/interfaces/grpc/ffi_wrapper.rs:179 (accepts 1..30) with src/interfaces/grpc/proto/echidna.proto:32 (declares 17 kinds). Also generated/abi/echidna_ffi.h:163 declares `int echidna_create_prover(int kind)` while the Rust takes u8, and ffi/zig/test/integration_test.zig:175 expects kind 30 to be rejected, which the Rust decoder accepts as TypedWasm. + +=== Open questions + +* AxiomPolicy::worst_danger and AxiomPolicy::is_acceptable (7 declarations, 2 rows): placed in rust because the functions exist, are public and match the Idris arm for arm. The review's reading is that they should retire unless enforce_policy is wired into dispatch, because no shipped path calls them. Which holds depends on an owner decision the source cannot settle: wire AxiomPolicy into dispatch (then the contracts matter), or delete the unwired functions (then both rows retire and the SPARK companion loses its Rust counterpart). +* clamp_trust (crates/echidna-core-creusot/src/lib.rs:282) has no caller outside its own tests. Reading one: keep it and add the monotone and idempotent contracts named in the clamp_monotone row. Reading two: delete it, and the clamp half of the clamp_lower_bound row goes with it. The TrustLevel::value range contract stands either way. +* Which prover-code table is the single source. kindToU8Injective is placed in idris2 over src/abi/EchidnaABI/Types.idr, which has 30 kinds against the Rust decoder's 141. Reading one: the Idris 2 ABI table grows to 141 and every encoder and decoder is checked against it. Reading two: the Rust table is the source and the Idris 2 table is generated or checked from it. The split of homes is the same in both; the direction of the check is an owner decision. +* E12 status. The nine round-trip statements are retired here with E12 named as an open successor. PROOF-STATUS R2 still lists E12 under one `proven` row. I did not decide whether E12 becomes its own `open` row or R2 is re-scoped; that is a ledger edit outside this placement. +* Both fail-loud findings (first-usage trust in the cross-checked path, and the GraphQL code mismatch) are read from source and compared by script. Neither was reproduced by running the code, and I did not check whether either is already recorded in an issue. diff --git a/docs/PROOF-STATUS.adoc b/docs/PROOF-STATUS.adoc index 10b37548..38c0f5e6 100644 --- a/docs/PROOF-STATUS.adoc +++ b/docs/PROOF-STATUS.adoc @@ -409,8 +409,11 @@ goes to Idris 2. A statement that holds for any implementation stays Agda theory. A statement that proves nothing about the system (true by definition, an instance of `+cong+`, or a model of behaviour the Rust lacks) retires, with its successor named. This applies to R3, R4's engineering modules, R9, R10 and -the Idris 2 verification corpus. The per-statement placement is recorded -separately. +the Idris 2 verification corpus. The per-statement placement is +`link:PROOF-PLACEMENT.adoc[PROOF-PLACEMENT]`: 233 rows, each one statement or a +named group, each in one area; 92 go to the Rust, 4 to Idris 2 and 31 stay +Agda theory, and 106 retire. It is a +placement read from source, not a receipt, and it changes no token here. **Design review of the statements (2026-11-09, at `+2ab7574+`, before #477 replaced the trust kernel and retired `+TrustKernelMonotonicity.idr+`):** the kernel accepting a proof