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.
This commit is contained in:
andrew committed 2026-11-17 10:28:15 -05:00
1 parent fc8335c380
commit bd5b3c885c
10 files changed
+48 -30

No files matched your search

+18
View File
@@ -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
-3
View File
@@ -195,13 +195,10 @@ theorem evalCountToggled_eq_cnt_toggle {db : DB} {bounds : List Key}
· simp [hlt, hmem] · simp [hlt, hmem]
try ring try ring
· simp [hlt] · simp [hlt]
try ring
· rw [dite_eq_right hmem, cnt_insert_eq db k hmem e] · rw [dite_eq_right hmem, cnt_insert_eq db k hmem e]
by_cases hlt : (k : WithTop Key) < e by_cases hlt : (k : WithTop Key) < e
· simp [hlt, hmem] · simp [hlt, hmem]
try ring
· simp [hlt] · simp [hlt]
try ring
/-- **One toggle witness in finite count form.** A database satisfying a system /-- **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` `S` while violating every constraint in a chosen list `bad` after toggling `k`
-3
View File
@@ -163,9 +163,6 @@ theorem cnt_le_intervalCard_nil (db : DB) (w : WithTop Key) :
(db.keys.filter (fun k => decide (k < ko))).length := by (db.keys.filter (fun k => decide (k < ko))).length := by
rw [cnt, List.countP_eq_length_filter] rw [cnt, List.countP_eq_length_filter]
congr 1 congr 1
apply List.filter_congr
intro k _
simp [WithTop.coe_lt_coe]
rw [hcnt, intervalCard_eq_encard_keysIn] rw [hcnt, intervalCard_eq_encard_keysIn]
exact h1 exact h1
@@ -63,10 +63,6 @@ theorem countP_lt_eq_add_filter_withTop (l : List Key) (hnd : l.Nodup) {a : Key}
Key)))).length = Key)))).length =
(l.filter (fun x : Key => decide (a ≤ x ∧ x < ke))).length := by (l.filter (fun x : Key => decide (a ≤ x ∧ x < ke))).length := by
congr 1 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] rw [hcoe, h, hf]
/-- **The begin resolution in the nonclamping negative-offset complete cell.** When the /-- **The begin resolution in the nonclamping negative-offset complete cell.** When the
@@ -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 (k : WithTop Key)) && decide ((k : WithTop Key) < r.end_.key)) := by
rw [List.countP_eq_length_filter] rw [List.countP_eq_length_filter]
congr 1 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] rw [hn', ← hs]
have hanchor_nonneg : 0 ≤ r.end_.anchor db := by have hanchor_nonneg : 0 ≤ r.end_.anchor db := by
by_contra hneg by_contra hneg
+1
View File
@@ -0,0 +1 @@
import Proof
+6
View File
@@ -0,0 +1,6 @@
{
"challenge_module": "Challenge",
"solution_module": "Solution",
"theorem_names": ["Statement.closedFormMinimal"],
"permitted_axioms": ["propext", "Quot.sound", "Classical.choice"]
}
+12 -12
View File
@@ -1,21 +1,21 @@
{"version": "1.2.0", {"version": "1.3.0",
"packagesDir": ".lake/packages", "packagesDir": ".lake/packages",
"packages": "packages":
[{"url": "https://github.com/leanprover-community/mathlib4", [{"url": "https://github.com/leanprover-community/mathlib4",
"type": "git", "type": "git",
"subDir": null, "subDir": null,
"scope": "leanprover-community", "scope": "leanprover-community",
"rev": "5ed2965256430c3649e86755f9576b54eca72435", "rev": "56a005855ea17e0b0958f73ec801ae140b0a1679",
"name": "mathlib", "name": "mathlib",
"manifestFile": "lake-manifest.json", "manifestFile": "lake-manifest.json",
"inputRev": "v4.34.0", "inputRev": "v4.35.0",
"inherited": false, "inherited": false,
"configFile": "lakefile.lean"}, "configFile": "lakefile.lean"},
{"url": "https://github.com/leanprover-community/plausible", {"url": "https://github.com/leanprover-community/plausible",
"type": "git", "type": "git",
"subDir": null, "subDir": null,
"scope": "leanprover-community", "scope": "leanprover-community",
"rev": "118aa17ee84656b8bd727fef7c458ee8c833385c", "rev": "dfa4f38190d07c37e315953e08b90fe2d95b3c24",
"name": "plausible", "name": "plausible",
"manifestFile": "lake-manifest.json", "manifestFile": "lake-manifest.json",
"inputRev": "main", "inputRev": "main",
@@ -25,7 +25,7 @@
"type": "git", "type": "git",
"subDir": null, "subDir": null,
"scope": "leanprover-community", "scope": "leanprover-community",
"rev": "ddf04cf3949fa556442341e87d47f9f6e6074707", "rev": "d6b4c7be5be75ec4917c873ac50c756dc1436372",
"name": "LeanSearchClient", "name": "LeanSearchClient",
"manifestFile": "lake-manifest.json", "manifestFile": "lake-manifest.json",
"inputRev": "main", "inputRev": "main",
@@ -35,7 +35,7 @@
"type": "git", "type": "git",
"subDir": null, "subDir": null,
"scope": "leanprover-community", "scope": "leanprover-community",
"rev": "e928b72544873815af278d38681b31c0293588e3", "rev": "a41f0e9a4dea23188ea9cc1c41ac9f8bbafe0b93",
"name": "importGraph", "name": "importGraph",
"manifestFile": "lake-manifest.json", "manifestFile": "lake-manifest.json",
"inputRev": "main", "inputRev": "main",
@@ -45,7 +45,7 @@
"type": "git", "type": "git",
"subDir": null, "subDir": null,
"scope": "leanprover-community", "scope": "leanprover-community",
"rev": "106ff4fafc74ef4ac99d81dbf3ab399118f497a5", "rev": "df72b022e558978a1c50264cfc4d7fec86fa8e04",
"name": "proofwidgets", "name": "proofwidgets",
"manifestFile": "lake-manifest.json", "manifestFile": "lake-manifest.json",
"inputRev": "main", "inputRev": "main",
@@ -55,7 +55,7 @@
"type": "git", "type": "git",
"subDir": null, "subDir": null,
"scope": "leanprover-community", "scope": "leanprover-community",
"rev": "355695d523e41d0554926416cba2a2b3544fbbc9", "rev": "4a174c490d8707121c4a9290800489f105d85e07",
"name": "aesop", "name": "aesop",
"manifestFile": "lake-manifest.json", "manifestFile": "lake-manifest.json",
"inputRev": "master", "inputRev": "master",
@@ -65,7 +65,7 @@
"type": "git", "type": "git",
"subDir": null, "subDir": null,
"scope": "leanprover-community", "scope": "leanprover-community",
"rev": "6a489d9af5d0c47e5b259e2e8bcdfc1811b5a259", "rev": "dce0ad79c486cb1fb504af04f953c3466b0c6db8",
"name": "Qq", "name": "Qq",
"manifestFile": "lake-manifest.json", "manifestFile": "lake-manifest.json",
"inputRev": "master", "inputRev": "master",
@@ -75,7 +75,7 @@
"type": "git", "type": "git",
"subDir": null, "subDir": null,
"scope": "leanprover-community", "scope": "leanprover-community",
"rev": "f2effa3d803fda822b1f97b806c47cf2adfbcbc2", "rev": "66e469188fe07963e5cf666c7d4433f45b8131c5",
"name": "batteries", "name": "batteries",
"manifestFile": "lake-manifest.json", "manifestFile": "lake-manifest.json",
"inputRev": "main", "inputRev": "main",
@@ -85,10 +85,10 @@
"type": "git", "type": "git",
"subDir": null, "subDir": null,
"scope": "leanprover", "scope": "leanprover",
"rev": "e92c9f15fdfacc8536f31cfb3b7ad26c3c8cd204", "rev": "c24fe6078c630e89b489bffe59b3e20ac30d12c8",
"name": "Cli", "name": "Cli",
"manifestFile": "lake-manifest.json", "manifestFile": "lake-manifest.json",
"inputRev": "v4.34.0", "inputRev": "v4.35.0",
"inherited": true, "inherited": true,
"configFile": "lakefile.toml"}], "configFile": "lakefile.toml"}],
"name": "«conflict-range»", "name": "«conflict-range»",
+10 -1
View File
@@ -1,6 +1,7 @@
name = "conflict-range" name = "conflict-range"
version = "0.1.0" version = "0.1.0"
defaultTargets = ["Statement", "Proof"] defaultTargets = ["Statement", "Proof"]
allowNonModules = true
[leanOptions] [leanOptions]
relaxedAutoImplicit = false relaxedAutoImplicit = false
@@ -10,7 +11,7 @@ maxSynthPendingDepth = 3
[[require]] [[require]]
name = "mathlib" name = "mathlib"
scope = "leanprover-community" scope = "leanprover-community"
rev = "v4.34.0" rev = "v4.35.0"
[[lean_lib]] [[lean_lib]]
name = "Statement" name = "Statement"
@@ -22,3 +23,11 @@ globs = ["FormalConflictRange.*"]
[[lean_lib]] [[lean_lib]]
name = "Proof" name = "Proof"
globs = ["Proof", "Bridge"] globs = ["Proof", "Bridge"]
[[lean_lib]]
name = "Challenge"
globs = ["Challenge"]
[[lean_lib]]
name = "Solution"
globs = ["Solution"]
+1 -1
View File
@@ -1 +1 @@
leanprover/lean4:v4.34.0 leanprover/lean4:v4.35.0