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

@@ -55,7 +55,7 @@ theorem clampNonposBottom_of_negCross_trunc_bottomGap {r : RangeRead} {res : Res
/-- The reported last key is the last of the result, and it lies below `begin.key`. -/
theorem negCrossTruncBottomGap_last {r : RangeRead} {res : Result}
(hne : res.keys ≠ []) (hcell : negCrossTruncBottomGap r res) :
(hne : res.keys ≠ []) (_hcell : negCrossTruncBottomGap r res) :
res.keys.getLastD ([] : Key) = res.keys.getLast hne := by
rw [List.getLastD_eq_getLast?, List.getLast?_eq_some_getLast hne]; rfl
@@ -193,7 +193,7 @@ theorem exists_padDb_compatible {r : RangeRead} {res : Result}
have hDget? : dbw.keys[res.keys.length]? = some (dbF.keys.head hFne) := by
change D[res.keys.length]? = some (dbF.keys.head hFne)
rw [hD, List.getElem?_append]
rw [if_neg (not_lt.mpr (le_refl _)), Nat.sub_self]
rw [ite_eq_right (not_lt.mpr (le_refl _)), Nat.sub_self]
rw [List.getElem?_eq_getElem (by rw [hFlen]; omega), List.head_eq_getElem hFne]
have hre : resolve dbw r.end_ = ((dbF.keys.head hFne : Key) : WithTop Key) := by
rw [resolve, ite_eq_right (by rw [hanchor_end]; omega)]
@@ -303,7 +303,7 @@ theorem exists_witness_below_head_bottomGap {r : RangeRead} {res : Result} {k :
rw [h1, h2, Nat.add_zero]
have hcount_ins : (dbw.insert k hk_not_dbw).keys.countP
(fun x : Key => decide ((x : WithTop Key) < r.begin.key)) = res.keys.length + 1 := by
rw [hins_keys, List.countP_cons, decide_eq_true_eq.mpr hk_lt_B, if_pos rfl, hrescnt]
rw [hins_keys, List.countP_cons, decide_eq_true_eq.mpr hk_lt_B, ite_eq_left rfl, hrescnt]
have hreported : reportedBelowBegin r res = res.keys.length := by
rw [reportedBelowBegin, List.countP_eq_length]
intro x hx
@@ -448,7 +448,7 @@ theorem exists_witness_erase_bottomGap {r : RangeRead} {res : Result} {k : Key}
rw [decide_eq_true_eq]; exact hkE
have h2 : (dbF.keys.erase k).countP
(fun x : Key => decide ((x : WithTop Key) < r.end_.key)) = clampNonposD r := by
rw [List.countP_erase, if_pos ⟨hk_in_F, hktrue⟩, hFall, hFlen]
rw [List.countP_erase, ite_eq_left ⟨hk_in_F, hktrue⟩, hFall, hFlen]
omega
rw [h1, h2]
have hd_int : ((clampNonposD r : ℕ) : ℤ) = -r.end_.offset := by
@@ -471,7 +471,7 @@ theorem exists_witness_erase_bottomGap {r : RangeRead} {res : Result} {k : Key}
((res.keys.getLast hne : Key) : WithTop Key) := by
have h0 : 0 ≤ r.end_.anchor (dbw.erase k) := by rw [hanchor_erase]; omega
have hlenErase : (dbw.erase k).keys.length = res.keys.length + clampNonposD r := by
rw [herase_keys, List.length_append, List.length_erase, if_pos hk_in_F, hFlen]
rw [herase_keys, List.length_append, List.length_erase, ite_eq_left hk_in_F, hFlen]
omega
have hlt : (r.end_.anchor (dbw.erase k)).toNat < (dbw.erase k).keys.length := by
rw [hanchor_erase, hlenErase]
@@ -523,12 +523,12 @@ theorem minimal_closedForm_of_negCross_trunc_bottomGap {r : RangeRead} {res : Re
((res.keys.head hne : Key) : WithTop Key)
· exact necessary_of_toggle
(exists_witness_below_head_bottomGap hread hcell' hne hkhead)
· push_neg at hkhead
· push Not at hkhead
by_cases hklast : ((k : Key) : WithTop Key) ≤
((res.keys.getLast hne : Key) : WithTop Key)
· exact necessary_of_between_result hread (List.head_mem hne) (List.getLast_mem hne)
(WithTop.coe_le_coe.mp hkhead) (WithTop.coe_le_coe.mp hklast)
· push_neg at hklast
· push Not at hklast
obtain ⟨dbw, hcompw, hkdbw, hnot⟩ :=
exists_witness_erase_bottomGap hread hcell' hne hklast hkE
exact necessary_of_toggle ⟨dbw, hcompw, by