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:
1 parent
a54a5f82f8
commit
af318a7d32
51 files changed
+2542
-1357
No files matched your search
@@ -124,8 +124,8 @@ theorem headD_eq_head_zero_cross_trunc {l : List Key} (h : l ≠ []) :
|
||||
/-- At begin offset zero, a compatible crossed truncated read resolves its begin
|
||||
selector onto the reported head. -/
|
||||
theorem resolve_begin_eq_head_of_zero_crossed_more {db : DB} {r : RangeRead} {res : Result}
|
||||
(hcomp : RangeRead.Compatible db r res) (hrev : r.reverse = false)
|
||||
(hmore : res.more = true) (hne : res.keys ≠ [])
|
||||
(hcomp : RangeRead.Compatible db r res) (_hrev : r.reverse = false)
|
||||
(_hmore : res.more = true) (hne : res.keys ≠ [])
|
||||
(hbegin : r.begin.offset = 0)
|
||||
(hcross : ((res.keys.head hne : Key) : WithTop Key) < r.begin.key) :
|
||||
resolve db r.begin = ((res.keys.head hne : Key) : WithTop Key) := by
|
||||
@@ -182,7 +182,8 @@ theorem completeKeys_filter_le_of_end_top {db : DB} {r : RangeRead} {H last : Ke
|
||||
(hbegin : resolve db r.begin = ((H : Key) : WithTop Key)) :
|
||||
(RangeRead.completeKeys db r).filter
|
||||
(fun k : Key => decide (k ≤ last)) =
|
||||
(db.keys.filter (fun k : Key => decide (((H : Key) : WithTop Key) ≤ (k : WithTop Key)))).filter
|
||||
(db.keys.filter (fun k : Key => decide (((H : Key) : WithTop Key) ≤ (k : WithTop
|
||||
Key)))).filter
|
||||
(fun k : Key => decide (k ≤ last)) := by
|
||||
rw [completeKeys_eq_filter_ge_of_end_top (db := db) hrev hendkey hendoff hbegin]
|
||||
|
||||
@@ -263,7 +264,8 @@ theorem filter_end_le_split_between {db : DB} {E : WithTop Key} {head last : Key
|
||||
simp only [List.mem_filter, decide_eq_true_eq] at hy
|
||||
exact lt_of_lt_of_le (WithTop.coe_lt_coe.mp hx.2.2) (WithTop.coe_le_coe.mp hy.2.1)
|
||||
· intro k
|
||||
rw [List.mem_filter, List.mem_filter, List.mem_append, between, List.mem_filter, List.mem_filter]
|
||||
rw [List.mem_filter, List.mem_filter, List.mem_append, between, List.mem_filter,
|
||||
List.mem_filter]
|
||||
simp only [decide_eq_true_eq]
|
||||
constructor
|
||||
· rintro ⟨⟨hkdb, hEk⟩, hklast⟩
|
||||
@@ -340,7 +342,8 @@ theorem compatible_of_agree_zeroCrossTrunc {r : RangeRead} {res : Result}
|
||||
lt_end_key_of_lt_resolve_end_offset_one hend hlast_db1 hlt1
|
||||
have hcnt : ((db2.keys.filter (fun k : Key => decide (r.end_.key ≤ (k : WithTop Key)))).filter
|
||||
(fun k : Key => decide (k ≤ last))).length ≤ (r.end_.offset - 1).toNat := by
|
||||
have hzero : ((db2.keys.filter (fun k : Key => decide (r.end_.key ≤ (k : WithTop Key)))).filter
|
||||
have hzero : ((db2.keys.filter (fun k : Key => decide (r.end_.key ≤ (k : WithTop
|
||||
Key)))).filter
|
||||
(fun k : Key => decide (k ≤ last))).length = 0 := by
|
||||
rw [List.length_eq_zero_iff, List.filter_eq_nil_iff]
|
||||
intro k hk
|
||||
@@ -1124,7 +1127,8 @@ theorem compatible_of_agree_zeroCrossTruncNonposEnd {r : RangeRead} {res : Resul
|
||||
(k : WithTop Key) < r.begin.key) := by
|
||||
intro k hk2 hkb
|
||||
have hk1 : k ∈ db1.keys :=
|
||||
(hmk k (le_of_lt hkb.1) (lt_of_lt_of_le hkb.2 (by rw [hupper]; exact le_max_left _ _))).mpr hk2
|
||||
(hmk k (le_of_lt hkb.1) (lt_of_lt_of_le hkb.2 (by rw [hupper]; exact le_max_left _ _))).mpr
|
||||
hk2
|
||||
exact hno1 k hk1 hkb
|
||||
have hres2 : resolve db2 r.begin = ((head : Key) : WithTop Key) :=
|
||||
resolve_begin_eq_of_no_between_zero hbegin hhead_db2 hcross' hno2
|
||||
@@ -1402,12 +1406,12 @@ theorem necessary_zeroCross_trunc_between_end_head {r : RangeRead} {res : Result
|
||||
have hlt : e1 < G + rl := by
|
||||
have hb := hbig'
|
||||
rw [← hG] at hb
|
||||
rw [← ENat.coe_add] at hb
|
||||
exact ENat.coe_lt_coe.mp hb
|
||||
rw [← ENat.natCast_add] at hb
|
||||
exact ENat.natCast_lt_natCast.mp hb
|
||||
have hGle : n + 1 ≤ G := by
|
||||
rw [hn]; omega
|
||||
rw [← hG]
|
||||
exact ENat.coe_le_coe.mpr hGle
|
||||
exact ENat.natCast_le_natCast.mpr hGle
|
||||
obtain ⟨dbK, hKrange, hkK, hKlen⟩ :=
|
||||
exists_db_keysIn_avoid (B := r.end_.key) (E := ((head : Key) : WithTop Key))
|
||||
(k := k) (m := n) hcard
|
||||
@@ -1710,7 +1714,8 @@ theorem necessary_zeroCross_trunc_above_begin {r : RangeRead} {res : Result} {k
|
||||
set head : Key := res.keys.head hne with hhead
|
||||
set last : Key := res.keys.getLast hne with hlast
|
||||
have hsort : res.keys.SortedLT := RangeRead.compatible_sortedLT hcomp₀ hrev
|
||||
have hle_last : ∀ x ∈ res.keys, x ≤ last := fun x hx => (hsort.pairwise.imp le_of_lt).rel_getLast hx
|
||||
have hle_last : ∀ x ∈ res.keys, x ≤ last := fun x hx => (hsort.pairwise.imp
|
||||
le_of_lt).rel_getLast hx
|
||||
have hcross' : ((head : Key) : WithTop Key) < r.begin.key := by
|
||||
rw [hhead]; exact hcross
|
||||
have hk_notmem : k ∉ res.keys := by
|
||||
@@ -1778,7 +1783,7 @@ theorem necessary_zeroCross_trunc_above_begin {r : RangeRead} {res : Result} {k
|
||||
ring
|
||||
have hget : dbw.keys[res.keys.length]? = some k := by
|
||||
rw [hdbw, 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]
|
||||
simp
|
||||
have hre : resolve dbw r.end_ = ((k : Key) : WithTop Key) := by
|
||||
rw [resolve, ite_eq_right (by rw [hanchor]; omega)]
|
||||
@@ -1825,7 +1830,6 @@ theorem necessary_zeroCross_trunc_above_begin {r : RangeRead} {res : Result} {k
|
||||
cases hE : r.end_.key with
|
||||
| top =>
|
||||
rw [anchor_of_top (s := r.end_) hE, hlen']
|
||||
push_cast
|
||||
rw [hend]
|
||||
ring
|
||||
| coe e =>
|
||||
@@ -1834,7 +1838,6 @@ theorem necessary_zeroCross_trunc_above_begin {r : RangeRead} {res : Result} {k
|
||||
rw [← countP_lt_coe (l := (dbw.erase k).keys) e, ← hE]
|
||||
exact hcount_end'
|
||||
rw [anchor_of_coe (s := r.end_) (v := e) hE, hce, hlen']
|
||||
push_cast
|
||||
rw [hend]
|
||||
ring
|
||||
have ht1 : 1 ≤ res.keys.length := List.length_pos_of_ne_nil hne
|
||||
@@ -1883,7 +1886,8 @@ theorem necessary_zeroCross_trunc_above_begin {r : RangeRead} {res : Result} {k
|
||||
exact ⟨fun h => h.2, fun h => ⟨hhead_le_all x hx, h⟩⟩]
|
||||
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]
|
||||
@@ -2069,7 +2073,7 @@ theorem exists_witness_zeroCross_trunc_nonposEnd {r : RangeRead} {res : Result}
|
||||
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)]
|
||||
@@ -2158,7 +2162,7 @@ theorem exists_witness_zeroCross_trunc_nonposEnd {r : RangeRead} {res : Result}
|
||||
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]
|
||||
@@ -2188,7 +2192,8 @@ theorem exists_witness_zeroCross_trunc_nonposEnd {r : RangeRead} {res : Result}
|
||||
exact ⟨fun h => h.2, fun h => ⟨hhead_le_all x hx, h⟩⟩]
|
||||
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]
|
||||
|
||||
Reference in new issue
Block a user