Skip to content

Commit d9b145d

Browse files
committed
feat(lean4): scaffold EchidnaTrustProofs lakefile + apply mechanical build fixes; update PROOF-NEEDS.md
Adds verification/proofs/lean4/lakefile.lean and lean-toolchain (leanprover/lean4:v4.13.0, no mathlib) so E10/E11/E13 proof files can be built with `lake build`. Library name: EchidnaTrustProofs. Roots: ConfidenceLattice, IntegrityVerification, ParetoMaximality, ParetoStrongMaximality, PortfolioCompleteness. Three mechanical fixes identified by static analysis: 1. ParetoStrongMaximality.lean: wrong import path EchidnaPareto.ParetoMaximality → ParetoMaximality (Lake maps module names to flat file paths; no subdirectory exists). 2. IntegrityVerification.lean: integrityToBool body was a Prop where Bool is required; fixed to decide (s = IntegrityStatus.verified). 3. ConfidenceLattice.lean: 10 level-distinctness theorems used omega on inductive-type constructor inequality; changed to decide. lake unavailable in 2026-05-11 build env — no actual build was run. Remaining tactic/API fixups tracked in #53. PROOF-NEEDS.md updated to reflect lakefile-scaffolded status for E10/E11/E13 and point to #53 for open items. https://claude.ai/code/session_01QoazAuafVkKFZnBkkQgGAH
1 parent c35b826 commit d9b145d

6 files changed

Lines changed: 48 additions & 17 deletions

File tree

PROOF-NEEDS.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ scaffolding with unresolved {{PROJECT}}/{{AUTHOR}} placeholders and no domain-sp
88
When this project needs formal ABI verification, create domain-specific Idris2 proofs
99
following the pattern in repos like `typed-wasm`, `proven`, `echidna`, or `boj-server`.
1010

11-
## Current state (Updated 2026-04-26)
11+
## Current state (Updated 2026-05-11)
1212

1313
### Completed proofs
1414

@@ -34,14 +34,14 @@ following the pattern in repos like `typed-wasm`, `proven`, `echidna`, or `boj-s
3434
|---|------|--------|--------|
3535
| E1 | Confidence scoring lattice (TrustLevel forms valid partial order) | L4 | Covered by ConfidenceLattice.lean |
3636
| E8 | VQL-UT query safety (SEC, deeper layer) | I2 | Partially covered by VqlUt.idr |
37-
| E10 | Pareto frontier maximality | L4 | **Design landed 2026-04-27** (`verification/proofs/lean4/ParetoMaximality.lean` + `ParetoStrongMaximality.lean` + Creusot mirror at `crates/echidna-core-spark/src/pareto.rs`); 11/12 PO theorems closed in main file (PO-1..PO-11); PO-12 strong maximality staged in `ParetoStrongMaximality.lean` as: `List.length_lt_of_subset_with_witness` (auxiliary List lemma, hand-rolled core-Lean) `domCount_strictly_decreases` (PD-3) → `dominated_by_frontier_member` (PO-12 via `Nat.strong_induction_on` on the descent measure). Proof structure complete; tactic-level fixups expected at first `lake build` (no Lean toolchain locally 2026-04-27 — agent `trig_01Tm7zTxYEY7kmzBsu7P4nc9` will catch). Adds `cs.Nodup` side-condition (cheap to satisfy from the indexed-list shape used by Rust `compute`). Tracking ticket: ECHIDNA-PARETO-DESCENT |
38-
| E11 | SHAKE3-512/BLAKE3 integrity | L4 | **Design landed 2026-04-27** (`verification/proofs/lean4/IntegrityVerification.lean`); 12 PI theorems including verifier soundness/completeness, status exhaustiveness, BLAKE3 cache freshness; collision-resistance theorems (PI-7, PI-9) state assumption explicitly as a typeclass per zero-axiom policy. NB: hash naming clarification — implementation is SHAKE-256 squeezing 512 bits, not "SHAKE3-512" |
39-
| E13 | Portfolio cross-checking completeness | L4 | **Design landed 2026-04-27** (`verification/proofs/lean4/PortfolioCompleteness.lean`); 14 PR theorems covering exhaustiveness, AllTimedOut iff no completed, CrossChecked agreement, Inconclusive disagreement detection, needs_review iff non-consensus, unanimity → CrossChecked |
37+
| E10 | Pareto frontier maximality | L4 | **Lakefile scaffolded 2026-05-11.** `verification/proofs/lean4/lakefile.lean` + `lean-toolchain` (v4.13.0) in place. PO-1..PO-11 (`ParetoMaximality.lean`) expected to compile cleanly — no imports, pure omega/decide arithmetic proofs. PO-12 (`ParetoStrongMaximality.lean`): import path fix applied (`EchidnaPareto.ParetoMaximality` `ParetoMaximality`); 8 List.Nodup API calls + `Nat.strong_induction_on` tactic syntax flagged as uncertain without a live toolchain — tracked in #53. `lake build` not yet run (`lake` unavailable in 2026-05-11 env). Tracking ticket: ECHIDNA-PARETO-DESCENT (math); #53 (tactic fixups). |
38+
| E11 | SHAKE3-512/BLAKE3 integrity | L4 | **Lakefile scaffolded 2026-05-11.** 12 PI theorems (PI-1..PI-12) expected to compile cleanly after mechanical fix: `integrityToBool` body corrected from bare `Prop` expression to `decide (s = IntegrityStatus.verified)`. Collision-resistance typeclasses (PI-7, PI-9) remain assumptions per zero-axiom policy. `match hf : file, hh : entry.hash` simultaneous named tactic match in `verify_sound` flagged in #53 as uncertain. `lake build` not yet run. NB: hash naming — implementation is SHAKE-256 squeezing 512 bits. |
39+
| E13 | Portfolio cross-checking completeness | L4 | **Lakefile scaffolded 2026-05-11.** 14 PR theorems (PR-1..PR-14) expected to mostly compile. Flagged in #53: `List.filter_eq_nil_iff` name (PR-14 prerequisite), `Option.some_injective``Option.some.inj` (PR-10), PR-14 `simp` through inner `let firstVerdict` may need `show` pre-computation. `lake build` not yet run. |
4040

4141
## Recommended prover
4242
- **Idris2** for ABI-level properties and prover dispatch correctness
4343
- **Lean4** for algebraic properties of the confidence lattice
4444
- **Agda** for metatheoretic properties of proof composition
4545

4646
## Priority
47-
- **MEDIUM** (was HIGH) — Core trust pipeline proofs (E2-E6) are now complete. E10-E13 design + statements landed 2026-04-27; remaining work is `lake build` integration (no Lean toolchain pinned in `verification/proofs/lean4/`; the existing `proofs/lean/lakefile.lean` is for the playground, not these proofs). E10-E13 are P2 and do not block the critical path.
47+
- **MEDIUM** (was HIGH) — Core trust pipeline proofs (E2-E6) are now complete. E10-E13 design + statements landed 2026-04-27; `verification/proofs/lean4/lakefile.lean` scaffolded 2026-05-11 (Lean 4.13.0, no mathlib). Remaining work: run `lake build` in an environment with Lean 4.13.0 and apply the API fixups tracked in #53. E10-E13 are P2 and do not block the critical path.

verification/proofs/lean4/ConfidenceLattice.lean

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,16 @@ theorem small_kernel_monotone (f : TrustFactors) :
356356
-- Section 6: Exhaustive level distinctness
357357
-- ==========================================================================
358358

359-
theorem level1_ne_level2 : Level1 ≠ Level2 := by omega
360-
theorem level1_ne_level3 : Level1 ≠ Level3 := by omega
361-
theorem level1_ne_level4 : Level1 ≠ Level4 := by omega
362-
theorem level1_ne_level5 : Level1 ≠ Level5 := by omega
363-
theorem level2_ne_level3 : Level2 ≠ Level3 := by omega
364-
theorem level2_ne_level4 : Level2 ≠ Level4 := by omega
365-
theorem level2_ne_level5 : Level2 ≠ Level5 := by omega
366-
theorem level3_ne_level4 : Level3 ≠ Level4 := by omega
367-
theorem level3_ne_level5 : Level3 ≠ Level5 := by omega
368-
theorem level4_ne_level5 : Level4 ≠ Level5 := by omega
359+
theorem level1_ne_level2 : Level1 ≠ Level2 := by decide
360+
theorem level1_ne_level3 : Level1 ≠ Level3 := by decide
361+
theorem level1_ne_level4 : Level1 ≠ Level4 := by decide
362+
theorem level1_ne_level5 : Level1 ≠ Level5 := by decide
363+
theorem level2_ne_level3 : Level2 ≠ Level3 := by decide
364+
theorem level2_ne_level4 : Level2 ≠ Level4 := by decide
365+
theorem level2_ne_level5 : Level2 ≠ Level5 := by decide
366+
theorem level3_ne_level4 : Level3 ≠ Level4 := by decide
367+
theorem level3_ne_level5 : Level3 ≠ Level5 := by decide
368+
theorem level4_ne_level5 : Level4 ≠ Level5 := by decide
369369

370370
-- ==========================================================================
371371
-- Section 7: Strict ordering chain

verification/proofs/lean4/IntegrityVerification.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ theorem quickReverify_complete (e : Blake3CacheEntry) (current : ByteString)
364364
canonical mapping here so that downstream proofs can chain the
365365
integrity result into the trust-level computation. -/
366366
def integrityToBool (s : IntegrityStatus) : Bool :=
367-
s = IntegrityStatus.verified
367+
decide (s = IntegrityStatus.verified)
368368

369369
/-- **PI-11 (E11/11) Trust gate**: `solver_integrity_ok` is `true` iff
370370
the verifier returns `verified`. -/

verification/proofs/lean4/ParetoStrongMaximality.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
-- than mathematical errors) are expected; the proof structure is
2626
-- the load-bearing artefact.
2727

28-
import EchidnaPareto.ParetoMaximality
28+
import ParetoMaximality
2929

3030
namespace EchidnaPareto
3131

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-- SPDX-License-Identifier: PMPL-1.0-or-later
2+
-- Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
--
4+
-- lakefile.lean — EchidnaTrustProofs
5+
--
6+
-- Builds the E-series verification proof obligations:
7+
-- E4 ConfidenceLattice.lean (trust-level partial order + scoring)
8+
-- E10 ParetoMaximality.lean (PO-1..PO-11 algebraic properties)
9+
-- ParetoStrongMaximality.lean (PO-12 descent / strong maximality)
10+
-- E11 IntegrityVerification.lean (SHAKE-256/512 + BLAKE3 verifier)
11+
-- E13 PortfolioCompleteness.lean (portfolio cross-checking)
12+
--
13+
-- Toolchain: leanprover/lean4:v4.13.0 (pinned in lean-toolchain).
14+
-- No mathlib dependency — proofs use only core Lean 4.
15+
16+
import Lake
17+
open Lake DSL
18+
19+
package echidna_trust_proofs where
20+
-- No external dependencies required.
21+
22+
@[default_target]
23+
lean_lib EchidnaTrustProofs where
24+
roots := #[
25+
`ConfidenceLattice,
26+
`IntegrityVerification,
27+
`ParetoMaximality,
28+
`ParetoStrongMaximality,
29+
`PortfolioCompleteness
30+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
leanprover/lean4:v4.13.0

0 commit comments

Comments
 (0)