From bd5b3c885c7af367790de50237158175afc1aa24 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Tue, 17 Nov 2026 10:28:15 -0500 Subject: [PATCH] Upgrade to Lean 4.35 and add comparator check - Move to lean-toolchain v4.35.0 and mathlib v4.35.0 - Opt out of the module-system warning with `allowNonModules` - Adapt to Lean/Mathlib 4.35 changes: drop now-redundant `List.filter_congr` blocks and no-op `ring` calls - Add `Challenge.lean`, `Solution.lean`, and `comparator.json` `lake comparator` now accepts the solution against the trusted challenge. --- Challenge.lean | 18 +++++++++++++++++ FormalConflictRange/CountBridge.lean | 3 --- FormalConflictRange/Empty.lean | 3 --- FormalConflictRange/NegCrossComplete.lean | 4 ---- FormalConflictRange/NonposClosedForm.lean | 6 ------ Solution.lean | 1 + comparator.json | 6 ++++++ lake-manifest.json | 24 +++++++++++------------ lakefile.toml | 11 ++++++++++- lean-toolchain | 2 +- 10 files changed, 48 insertions(+), 30 deletions(-) create mode 100644 Challenge.lean create mode 100644 Solution.lean create mode 100644 comparator.json diff --git a/Challenge.lean b/Challenge.lean new file mode 100644 index 0000000..b25e676 --- /dev/null +++ b/Challenge.lean @@ -0,0 +1,18 @@ +import Statement + +/-! +# Challenge: minimality of the conflict-range closed form + +This file is the trusted statement side of the comparator check. It states the +headline theorem with a placeholder proof; `lake comparator` compares this +statement against the proof in `Solution.lean`. +-/ + +namespace Statement + +/-- **The closed form is minimal.** For every readable read/result pair, +`closedForm r res` is a minimal sound conflict range. -/ +theorem closedFormMinimal : ClosedFormMinimal := by + sorry + +end Statement diff --git a/FormalConflictRange/CountBridge.lean b/FormalConflictRange/CountBridge.lean index ab62b35..26d523e 100644 --- a/FormalConflictRange/CountBridge.lean +++ b/FormalConflictRange/CountBridge.lean @@ -195,13 +195,10 @@ theorem evalCountToggled_eq_cnt_toggle {db : DB} {bounds : List Key} · simp [hlt, hmem] try ring · simp [hlt] - try ring · rw [dite_eq_right hmem, cnt_insert_eq db k hmem e] by_cases hlt : (k : WithTop Key) < e · simp [hlt, hmem] - try ring · simp [hlt] - try ring /-- **One toggle witness in finite count form.** A database satisfying a system `S` while violating every constraint in a chosen list `bad` after toggling `k` diff --git a/FormalConflictRange/Empty.lean b/FormalConflictRange/Empty.lean index c5fe9ee..5ff390d 100644 --- a/FormalConflictRange/Empty.lean +++ b/FormalConflictRange/Empty.lean @@ -163,9 +163,6 @@ theorem cnt_le_intervalCard_nil (db : DB) (w : WithTop Key) : (db.keys.filter (fun k => decide (k < ko))).length := by rw [cnt, List.countP_eq_length_filter] congr 1 - apply List.filter_congr - intro k _ - simp [WithTop.coe_lt_coe] rw [hcnt, intervalCard_eq_encard_keysIn] exact h1 diff --git a/FormalConflictRange/NegCrossComplete.lean b/FormalConflictRange/NegCrossComplete.lean index d137a5e..9e9f61a 100644 --- a/FormalConflictRange/NegCrossComplete.lean +++ b/FormalConflictRange/NegCrossComplete.lean @@ -63,10 +63,6 @@ theorem countP_lt_eq_add_filter_withTop (l : List Key) (hnd : l.Nodup) {a : Key} Key)))).length = (l.filter (fun x : Key => decide (a ≤ x ∧ x < ke))).length := by congr 1 - apply List.filter_congr - intro k _ - rw [decide_eq_decide] - simp only [WithTop.coe_le_coe, WithTop.coe_lt_coe] rw [hcoe, h, hf] /-- **The begin resolution in the nonclamping negative-offset complete cell.** When the diff --git a/FormalConflictRange/NonposClosedForm.lean b/FormalConflictRange/NonposClosedForm.lean index f912492..4ca0ac2 100644 --- a/FormalConflictRange/NonposClosedForm.lean +++ b/FormalConflictRange/NonposClosedForm.lean @@ -983,12 +983,6 @@ theorem filler_count_nonpos_more_nonpos_end {db : DB} {r : RangeRead} {res : Res (k : WithTop Key)) && decide ((k : WithTop Key) < r.end_.key)) := by rw [List.countP_eq_length_filter] congr 1 - apply List.filter_congr - intro k _ - rw [Bool.decide_and] - rw [show decide (last < k) = - decide ((↑last : WithTop Key) < (↑k : WithTop Key)) from - decide_eq_decide.mpr (WithTop.coe_lt_coe.symm)] rw [hn', ← hs] have hanchor_nonneg : 0 ≤ r.end_.anchor db := by by_contra hneg diff --git a/Solution.lean b/Solution.lean new file mode 100644 index 0000000..f637ebf --- /dev/null +++ b/Solution.lean @@ -0,0 +1 @@ +import Proof diff --git a/comparator.json b/comparator.json new file mode 100644 index 0000000..38140b2 --- /dev/null +++ b/comparator.json @@ -0,0 +1,6 @@ +{ + "challenge_module": "Challenge", + "solution_module": "Solution", + "theorem_names": ["Statement.closedFormMinimal"], + "permitted_axioms": ["propext", "Quot.sound", "Classical.choice"] +} diff --git a/lake-manifest.json b/lake-manifest.json index 9866e24..3ae228b 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -1,21 +1,21 @@ -{"version": "1.2.0", +{"version": "1.3.0", "packagesDir": ".lake/packages", "packages": [{"url": "https://github.com/leanprover-community/mathlib4", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "5ed2965256430c3649e86755f9576b54eca72435", + "rev": "56a005855ea17e0b0958f73ec801ae140b0a1679", "name": "mathlib", "manifestFile": "lake-manifest.json", - "inputRev": "v4.34.0", + "inputRev": "v4.35.0", "inherited": false, "configFile": "lakefile.lean"}, {"url": "https://github.com/leanprover-community/plausible", "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", + "rev": "dfa4f38190d07c37e315953e08b90fe2d95b3c24", "name": "plausible", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -25,7 +25,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", + "rev": "d6b4c7be5be75ec4917c873ac50c756dc1436372", "name": "LeanSearchClient", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -35,7 +35,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "e928b72544873815af278d38681b31c0293588e3", + "rev": "a41f0e9a4dea23188ea9cc1c41ac9f8bbafe0b93", "name": "importGraph", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -45,7 +45,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", + "rev": "df72b022e558978a1c50264cfc4d7fec86fa8e04", "name": "proofwidgets", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -55,7 +55,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "355695d523e41d0554926416cba2a2b3544fbbc9", + "rev": "4a174c490d8707121c4a9290800489f105d85e07", "name": "aesop", "manifestFile": "lake-manifest.json", "inputRev": "master", @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", + "rev": "dce0ad79c486cb1fb504af04f953c3466b0c6db8", "name": "Qq", "manifestFile": "lake-manifest.json", "inputRev": "master", @@ -75,7 +75,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", + "rev": "66e469188fe07963e5cf666c7d4433f45b8131c5", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "main", @@ -85,10 +85,10 @@ "type": "git", "subDir": null, "scope": "leanprover", - "rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", + "rev": "c24fe6078c630e89b489bffe59b3e20ac30d12c8", "name": "Cli", "manifestFile": "lake-manifest.json", - "inputRev": "v4.34.0", + "inputRev": "v4.35.0", "inherited": true, "configFile": "lakefile.toml"}], "name": "«conflict-range»", diff --git a/lakefile.toml b/lakefile.toml index 4115290..7fc5c6d 100644 --- a/lakefile.toml +++ b/lakefile.toml @@ -1,6 +1,7 @@ name = "conflict-range" version = "0.1.0" defaultTargets = ["Statement", "Proof"] +allowNonModules = true [leanOptions] relaxedAutoImplicit = false @@ -10,7 +11,7 @@ maxSynthPendingDepth = 3 [[require]] name = "mathlib" scope = "leanprover-community" -rev = "v4.34.0" +rev = "v4.35.0" [[lean_lib]] name = "Statement" @@ -22,3 +23,11 @@ globs = ["FormalConflictRange.*"] [[lean_lib]] name = "Proof" globs = ["Proof", "Bridge"] + +[[lean_lib]] +name = "Challenge" +globs = ["Challenge"] + +[[lean_lib]] +name = "Solution" +globs = ["Solution"] diff --git a/lean-toolchain b/lean-toolchain index 12359f9..a6aff06 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:v4.34.0 +leanprover/lean4:v4.35.0