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

@@ -175,7 +175,7 @@ theorem exists_clamp_compat_nonpos_lastGe_prefix {r : RangeRead} {res : Result}
exact hfilt_b
refine ⟨db, ⟨hlim, ?_⟩, hanchor⟩
rcases hcomp₀.2 with ⟨hmore, -, -⟩ | ⟨hmore, -⟩
· exact Or.inl ⟨hmore, by simpa [hck] using (List.prefix_refl res.keys), hne⟩
· exact Or.inl ⟨hmore, by simp [hck], hne⟩
· exact Or.inr ⟨hmore, hck.symm⟩
/-- **Soundness of `[⊥, end_.key)` for truncated results.** Agreement on every key below
@@ -402,7 +402,7 @@ theorem exists_witness_negCross_trunc_clamp_above_last {r : RangeRead} {res : Re
have hDget? : dbw.keys[res.keys.length]? = some (F.head hFne) := by
change D[res.keys.length]? = some (F.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_ = ((F.head hFne : Key) : WithTop Key) := by
rw [resolve, ite_eq_right (by rw [hanchor_end]; omega)]
@@ -499,7 +499,7 @@ theorem exists_witness_negCross_trunc_clamp_above_last {r : RangeRead} {res : Re
rw [hanchor_end', hEqInt, Int.toNat_natCast]
have hD'get? : (dbw.erase k).keys[res.keys.length - 1]? = some last := by
rw [hD', List.getElem?_append]
rw [if_pos (by omega : res.keys.length - 1 < res.keys.length)]
rw [ite_eq_left (by omega : res.keys.length - 1 < res.keys.length)]
rw [List.getElem?_eq_getElem (by omega : res.keys.length - 1 < res.keys.length)]
congr 1
rw [hlast, List.getLast_eq_getElem hne]
@@ -520,7 +520,8 @@ theorem exists_witness_negCross_trunc_clamp_above_last {r : RangeRead} {res : Re
rw [List.filter_congr hpred, hD', List.filter_append]
conv_lhs => rw [← List.dropLast_append_getLast hne, hlast]
rw [List.filter_append]
have hfil : res.keys.dropLast.filter (fun x : Key => decide (x < last)) = res.keys.dropLast := by
have hfil : res.keys.dropLast.filter (fun x : Key => decide (x < last)) = res.keys.dropLast :=
by
rw [List.filter_eq_self]
intro x hx
rw [decide_eq_true_eq]
@@ -569,7 +570,7 @@ theorem necessary_negCross_trunc_clamp_above_last {r : RangeRead} {res : Result}
exact hnot⟩
/-- The closed form of the cell: `[⊥, end_.key)`. -/
noncomputable def closedFormNegCrossTruncClampLastGe (r : RangeRead) (res : Result) :
noncomputable def closedFormNegCrossTruncClampLastGe (r : RangeRead) (_res : Result) :
ConflictRange :=
⟨(([] : Key) : WithTop Key), r.end_.key⟩
@@ -598,11 +599,11 @@ theorem minimal_closedForm_of_negCross_trunc_clamp_lastGe {r : RangeRead} {res :
intro k hkbot hkE
by_cases hkhead : ((k : Key) : WithTop Key) < ((res.keys.head hne : Key) : WithTop Key)
· exact necessary_below_head_of_anchor_nonpos_negCross db hcomp hrev hne hanchor 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
exact necessary_negCross_trunc_clamp_above_last hread' hrev hmore hne hbegin hend
hclamp hB_le_last (WithTop.coe_lt_coe.mp hklast) hkE