Fix all Lean build warnings

- Update deprecated lemmas (ite_eq_left/right, ENat casts, List.Sublist, ...)
- Replace push_neg with push Not and resolve unused-variable warnings
- Convert flexible simp/simp_all calls to explicit simp only lists
- Remove unscoped maxHeartbeats options, open scoped Classical, and unused tactics
- Add missing module docstrings and clean up style linter hits
- Wrap over-long lines and flatten the deeply nested
  minimal_conflictRangeClosedForm_total proof

`lake build` now completes with zero warnings.
This commit is contained in:
andrew committed 2026-11-17 10:04:35 -05:00
1 parent a54a5f82f8
commit af318a7d32
51 files changed
+2542 -1357

No files matched your search

@@ -35,7 +35,6 @@ holds automatically, so the upper endpoint is `keyAfter head`; when the head lie
namespace FormalConflictRange
set_option maxHeartbeats 1600000
/-- A subset of a duplicate-free list is no longer than it. -/
theorem length_le_of_nodup_subset {l₁ l₂ : List Key} (h : l₁.Nodup) (hsub : l₁ ⊆ l₂) :
@@ -74,7 +73,8 @@ theorem between_end_key_last_eq_nil {db : DB} {r : RangeRead} {res : Result}
have hLRle : ((L : Key) : WithTop Key) ≤ resolve db r.end_ := le_of_lt hLR
have hoff : 1 ≤ r.end_.offset := by omega
have hnsub : res.keys.Nodup :=
List.Nodup.sublist (RangeRead.compatible_keys_prefix hcomp).sublist (RangeRead.completeKeys_nodup db r)
List.Nodup.sublist (RangeRead.compatible_keys_prefix hcomp).sublist
(RangeRead.completeKeys_nodup db r)
rcases eq_or_ne (resolve db r.end_) (⊤ : WithTop Key) with hRtop | hRne
· -- the end resolution is the sentinel
have hresend := resolve_eq_filter_getElem? (db := db) (s := r.end_) hoff
@@ -195,7 +195,7 @@ theorem compatible_iff_over_reduce {r : RangeRead} {res : Result}
have hres := hresolve hnil
unfold RangeRead.completeKeys
rw [hr'rev, hrev]
simp only [Bool.not_true, ite_false, ite_true]
simp only [ ite_true]
rw [hres]
constructor
· intro hcomp
@@ -224,7 +224,7 @@ theorem necessary_of_forall_not_mem {r : RangeRead} {res : Result} {k : Key}
/-- If one database stores no key in `[E, L)` and two databases agree on `[E, U)` with
`L ≤ U`, then neither does the other. -/
theorem between_eq_nil_of_agreeOn {db₁ db₂ : DB} {E L U : WithTop Key}
(hE : E ≤ L) (hLU : L ≤ U) (hnil : between db₁ E L = [])
(_hE : E ≤ L) (hLU : L ≤ U) (hnil : between db₁ E L = [])
(hagree : AgreeOn ⟨E, U⟩ db₁ db₂) :
between db₂ E L = [] := by
rw [List.eq_nil_iff_forall_not_mem]
@@ -366,7 +366,8 @@ theorem necessary_of_mem_gap_of_negCross_trunc_rev_residualFiniteOver
have hcrossG : ∀ x ∈ res.keys.reverse, ∀ y ∈ G, x < y := by
intro x hx y hy
have hx' : x ∈ res.keys := List.mem_reverse.mp hx
exact WithTop.coe_lt_coe.mp (lt_of_le_of_lt (WithTop.coe_le_coe.mpr (hHge x hx')) (hH_lt_G y hy))
exact WithTop.coe_lt_coe.mp (lt_of_le_of_lt (WithTop.coe_le_coe.mpr (hHge x hx')) (hH_lt_G y
hy))
have hkeysSorted : (res.keys.reverse ++ G).SortedLT :=
List.sortedLT_append.mpr ⟨hresSort, hGsorted, hcrossG⟩
let db_a : DB := ⟨res.keys.reverse ++ G, hkeysSorted⟩
@@ -440,7 +441,8 @@ theorem necessary_of_mem_gap_of_negCross_trunc_rev_residualFiniteOver
| nil => exact WithTop.coe_lt_top _
| cons g gs =>
simp only [List.getElem?_cons_zero]
exact lt_of_le_of_lt (WithTop.coe_le_coe.mpr (hHge x hx)) (hH_lt_G g (by rw [hG]; exact List.mem_cons_self))
exact lt_of_le_of_lt (WithTop.coe_le_coe.mpr (hHge x hx)) (hH_lt_G g (by rw [hG]; exact
List.mem_cons_self))
have hG_not_lt_res : ∀ y ∈ G, ¬ ((y : Key) : WithTop Key) < resolve db_a r.end_ := by
intro y hy
rw [hresEnd]