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

+10 -11
View File
@@ -18,7 +18,6 @@ head, so the target is necessary regardless of the end key.
namespace FormalConflictRange
set_option maxHeartbeats 1200000
/-- Split the half-open interval above a key at its immediate successor. -/
theorem intervalCard_last_eq_keyAfter_add_one {last : Key} {B : WithTop Key}
@@ -177,7 +176,7 @@ head. Such a key and all reported keys would lie at or below the reported last,
the end-count bound forced by `last < resolve end_`. -/
theorem not_lt_head_of_mem_of_compatible_saturated {db : DB} {r : RangeRead} {res : Result}
(hcomp : RangeRead.Compatible db r res) (hrev : r.reverse = false)
(hmore : res.more = true) (hne : res.keys ≠ []) (hendoff : 1 ≤ r.end_.offset)
(_hmore : res.more = true) (hne : res.keys ≠ []) (hendoff : 1 ≤ r.end_.offset)
(hE : r.end_.key = (([] : Key) : WithTop Key))
(hsat : (r.end_.offset - 1).toNat = res.keys.length)
{x : Key} (hxdb : x ∈ db.keys) (hxhead : x < res.keys.head hne) : False := by
@@ -320,7 +319,7 @@ theorem compatible_of_nil_cons_gapKeys_high_of_end_count {r : RangeRead} {res :
(hheadne : res.keys.headD ([] : Key) ≠ ([] : Key))
(hgap : (((keyAfter (res.keys.getLastD ([] : Key)) : Key)) : WithTop Key) <
r.begin.key)
(hsort : res.keys.SortedLT) (hJ : J.SortedLT)
(hsort : res.keys.SortedLT) (_hJ : J.SortedLT)
(hJrange : ∀ x ∈ J, (((keyAfter (res.keys.getLastD ([] : Key)) : Key)) : WithTop Key) ≤
((x : Key) : WithTop Key) ∧ ((x : Key) : WithTop Key) < r.begin.key)
(hJlen : J.length = beginSlack r + 1 - res.keys.length)
@@ -376,7 +375,7 @@ theorem compatible_of_nil_cons_gapKeys_high_of_end_count {r : RangeRead} {res :
((([] : Key) : WithTop Key)) < r.begin.key) := by
intro h
exact (not_le.mpr (WithTop.coe_lt_coe.mpr hnil_lt_head)) h.1
rw [if_neg (by simpa only [decide_eq_true_eq] using hnil)]
rw [ite_eq_right (by simpa only [decide_eq_true_eq] using hnil)]
rw [List.filter_eq_self]
intro x hx
rw [decide_eq_true_eq]
@@ -410,7 +409,7 @@ theorem compatible_of_nil_cons_gapKeys_high_of_end_count {r : RangeRead} {res :
intro hcon
rw [Bool.and_eq_true, Bool.and_eq_true] at hcon
exact (not_le.mpr hnil_lt_head) (of_decide_eq_true hcon.2.1)
rw [if_neg hnil_pred]
rw [ite_eq_right hnil_pred]
have h1 : res.keys.filter (fun k : Key => decide (k ≤ last) && (decide (head ≤ k) &&
decide (((k : Key) : WithTop Key) < resolve db r.end_))) = res.keys := by
rw [List.filter_eq_self]
@@ -460,7 +459,7 @@ theorem end_count_nil_cons_gapKeys_of_unsaturated {r : RangeRead} {res : Result}
([] : Key) :: res.keys := by
rw [hkeys, List.filter_cons, List.filter_append]
have hnil : decide (([] : Key) ≤ last) = true := by simp [nil_le_key]
rw [if_pos hnil]
rw [ite_eq_left hnil]
have h1 : res.keys.filter (fun k : Key => decide (k ≤ last)) = res.keys := by
rw [List.filter_eq_self]
intro x hx
@@ -482,7 +481,7 @@ theorem end_count_nil_cons_gapKeys_of_unsaturated {r : RangeRead} {res : Result}
exact coe_nil_le_key_withTop _
have hnilE : decide (r.end_.key ≤ ((([] : Key) : WithTop Key))) = true := by
rw [decide_eq_true_eq, hE]
rw [List.filter_cons, if_pos hnilE, hresE, List.length_cons]
rw [List.filter_cons, ite_eq_left hnilE, hresE, List.length_cons]
have hbase' : res.keys.length ≤ (r.end_.offset - 1).toNat := by
rwa [hresE] at hbase
have hne_count := hunsat.resolve_left (not_not.mpr hE)
@@ -740,7 +739,7 @@ theorem necessary_gap_padded {r : RangeRead} {res : Result} {k : Key}
· intro x
simp only [List.mem_filter, decide_eq_true_eq]
have hdbiff : x ∈ db1.keys ↔ x = k ∨ x ∈ db0.keys := by
show x ∈ ([] : Key) :: (res.keys ++ J) ↔
change x ∈ ([] : Key) :: (res.keys ++ J) ↔
x = k ∨ x ∈ ([] : Key) :: (res.keys ++ dbJ.keys)
unfold J
simp only [List.mem_cons, List.mem_append, List.mem_orderedInsert]
@@ -870,7 +869,7 @@ theorem compatible_iff_noGapRead_of_gapExactSaturated {r : RangeRead} {res : Res
(beginSlack r : ℤ) - 1 := by
have hs : beginSlack (noGapRead r res) = beginSlack r := rfl
rw [anchor_eq_count_sub_slack db (noGapRead r res) (le_of_lt hbegin), hs]
simp [cnt, noGapRead, hlastD, hlastD']
simp [cnt, noGapRead, hlastD']
rw [h_eq, hcntK]
have h1 : (t : ℤ) ≤ (q : ℤ) := by exact_mod_cast htq
rw [← hq]
@@ -909,7 +908,7 @@ theorem compatible_iff_noGapRead_of_gapExactSaturated {r : RangeRead} {res : Res
r.begin.key := by
rw [hg]
exact between_length_le_intervalCard (db := db) (le_of_lt hgap')
exact ENat.coe_le_coe.mp (hgA.trans hcap'.le)
exact ENat.natCast_le_natCast.mp (hgA.trans hcap'.le)
have htg : t + g ≤ q + 1 := by rw [hT] at hgT; omega
have hanchor : r.begin.anchor db ≤ 0 := by
have h_eq : r.begin.anchor db =
@@ -926,7 +925,7 @@ theorem compatible_iff_noGapRead_of_gapExactSaturated {r : RangeRead} {res : Res
have hck := completeKeys_noGapRead_eq_of_no_lt_head hrev hno hbr hbng
rw [compatible_iff_truncated_keys hrev hmore hne]
rw [compatible_iff_truncated_keys (r := noGapRead r res) hrev hmore hne] at hcompNG
exact ⟨by change RangeRead.withinLimit r res.keys; exact hcompNG.1,
exact ⟨by exact hcompNG.1,
by rw [hck]; exact hcompNG.2⟩
/-- The lowered read satisfies the arbitrary-end no-gap clamping cell. -/