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
@@ -693,7 +693,7 @@ theorem completeKeys_eq_iff_filter_drop_of_room_general {db : DB} {r : RangeRead
|
||||
without changing compatibility. This is the general-offset form of
|
||||
`compatible_crossed_iff_endKeyToBegin_of_room`. -/
|
||||
theorem compatible_crossed_iff_endKeyToBegin_of_room_general {r : RangeRead} {res : Result}
|
||||
(hread : Readable r res) (hmore : res.more = false) (hne : res.keys ≠ [])
|
||||
(_hread : Readable r res) (hmore : res.more = false) (hne : res.keys ≠ [])
|
||||
(hrev : r.reverse = false) (hbegin : 1 ≤ r.begin.offset)
|
||||
(hcross : r.end_.key < r.begin.key) (hend : 2 ≤ r.end_.offset)
|
||||
(htb : res.keys.length + (r.begin.offset - 1).toNat <
|
||||
@@ -762,7 +762,8 @@ theorem compatible_crossed_iff_endKeyToBegin_of_room_general {r : RangeRead} {re
|
||||
· simp [hmore] at hdisj
|
||||
· refine ⟨?_, (completeKeys_eq_iff_filter_drop_of_room_general
|
||||
(db := db) (r := endKeyToBegin r) (res := res) (by simpa [endKeyToBegin] using hrev)
|
||||
(by simpa [endKeyToBegin] using hbegin) (by simpa [endKeyToBegin] using (by omega : 1 ≤ r.end_.offset))
|
||||
(by simpa [endKeyToBegin] using hbegin) (by simpa [endKeyToBegin] using (by omega : 1 ≤
|
||||
r.end_.offset))
|
||||
(by simp [endKeyToBegin]) hne hroom_db').mp heq.symm⟩
|
||||
simpa [endKeyToBegin, RangeRead.withinLimit] using hlim
|
||||
· rintro ⟨hlim, hfil⟩
|
||||
@@ -770,7 +771,8 @@ theorem compatible_crossed_iff_endKeyToBegin_of_room_general {r : RangeRead} {re
|
||||
· simpa [endKeyToBegin, RangeRead.withinLimit] using hlim
|
||||
· exact ((completeKeys_eq_iff_filter_drop_of_room_general
|
||||
(db := db) (r := endKeyToBegin r) (res := res) (by simpa [endKeyToBegin] using hrev)
|
||||
(by simpa [endKeyToBegin] using hbegin) (by simpa [endKeyToBegin] using (by omega : 1 ≤ r.end_.offset))
|
||||
(by simpa [endKeyToBegin] using hbegin) (by simpa [endKeyToBegin] using (by omega : 1 ≤
|
||||
r.end_.offset))
|
||||
(by simp [endKeyToBegin]) hne hroom_db').mpr hfil).symm
|
||||
rw [hbase_r, hbase_r']
|
||||
|
||||
@@ -815,7 +817,7 @@ theorem minimal_topRange_of_crossed_small_room_general {r : RangeRead} {res : Re
|
||||
(by simpa [r', endKeyToBegin] using hend)
|
||||
have hform : closedFormKeyEqComplete r' res = ⟨r.begin.key, ⊤⟩ := by
|
||||
unfold closedFormKeyEqComplete
|
||||
rw [if_neg htne]
|
||||
rw [ite_eq_right htne]
|
||||
simp [topRange, r', endKeyToBegin]
|
||||
rw [hform] at hmin'
|
||||
exact minimal_of_compatible_iff hiff hmin'
|
||||
@@ -826,7 +828,7 @@ stored keys just above `begin.key` and before the first reported key exist, are
|
||||
sorted, lie at or above `begin.key`, and lie strictly below every reported key. -/
|
||||
theorem crossed_pad_general {db : DB} {r : RangeRead} {res : Result}
|
||||
(hrev : r.reverse = false) (hbegin : 1 ≤ r.begin.offset)
|
||||
(hcross : r.end_.key < r.begin.key) (hend : 1 ≤ r.end_.offset)
|
||||
(_hcross : r.end_.key < r.begin.key) (hend : 1 ≤ r.end_.offset)
|
||||
(hne : res.keys ≠ []) (hres : res.keys = RangeRead.completeKeys db r) :
|
||||
∃ P : List Key, P.length = (r.begin.offset - 1).toNat ∧ P.SortedLT ∧
|
||||
(∀ x ∈ P, r.begin.key ≤ (x : WithTop Key)) ∧
|
||||
@@ -906,11 +908,11 @@ theorem crossed_pad_general {db : DB} {r : RangeRead} {res : Result}
|
||||
/-- Generic complete-window computation for a database of the form `P ++ res` with
|
||||
`P` padding of length `b`, all at or above the begin key and below the reported keys. -/
|
||||
theorem completeKeys_pad_eq_general {r : RangeRead} {res : Result} {P : List Key}
|
||||
(hPs : P.SortedLT) (hresS : res.keys.SortedLT)
|
||||
(_hPs : P.SortedLT) (_hresS : res.keys.SortedLT)
|
||||
(hPlen : P.length = (r.begin.offset - 1).toNat)
|
||||
(hPge : ∀ x ∈ P, r.begin.key ≤ (x : WithTop Key))
|
||||
(hresge : ∀ y ∈ res.keys, r.begin.key ≤ (y : WithTop Key))
|
||||
(hPlt : ∀ x ∈ P, ∀ y ∈ res.keys, x < y)
|
||||
(_hPlt : ∀ x ∈ P, ∀ y ∈ res.keys, x < y)
|
||||
(hsort : (P ++ res.keys).SortedLT)
|
||||
(hrev : r.reverse = false) (hbegin : 1 ≤ r.begin.offset)
|
||||
(hcross : r.end_.key < r.begin.key) (hend : 1 ≤ r.end_.offset)
|
||||
@@ -951,7 +953,7 @@ theorem completeKeys_pad_eq_general {r : RangeRead} {res : Result} {P : List Key
|
||||
|
||||
|
||||
theorem completeKeys_length_pad_general {r : RangeRead} {res : Result} {Q : List Key}
|
||||
(hQs : Q.SortedLT) (hsort : (Q ++ res.keys).SortedLT)
|
||||
(_hQs : Q.SortedLT) (hsort : (Q ++ res.keys).SortedLT)
|
||||
(hQge : ∀ x ∈ Q, r.begin.key ≤ (x : WithTop Key))
|
||||
(hresge : ∀ y ∈ res.keys, r.begin.key ≤ (y : WithTop Key))
|
||||
(hrev : r.reverse = false) (hbegin : 1 ≤ r.begin.offset)
|
||||
@@ -1017,7 +1019,7 @@ theorem necessary_of_begin_le_crossed_top_general {r : RangeRead} {res : Result}
|
||||
let dB : DB := dT.erase x
|
||||
have hdBkeys : dB.keys = P.erase x ++ res.keys := by
|
||||
simp only [dB, dT, DB.erase_keys]
|
||||
rw [List.erase_append, if_pos hxP]
|
||||
rw [List.erase_append, ite_eq_left hxP]
|
||||
have hQlen : (P.erase x).length = b - 1 := by
|
||||
rw [List.length_erase_of_mem hxP, hPlen']
|
||||
have hQs : (P.erase x).SortedLT :=
|
||||
@@ -1248,7 +1250,7 @@ theorem necessary_of_mem_interval_crossed_top_general {r : RangeRead} {res : Res
|
||||
exact le_trans (le_of_lt hcross)
|
||||
(le_trans hlast_ge_B (WithTop.coe_le_coe.mpr hCge))
|
||||
have hp₂ : cnt db₂ r.begin.key = s - 1 := by
|
||||
show db₂.keys.countP (fun x : Key => decide ((x : WithTop Key) < r.begin.key)) = s - 1
|
||||
change db₂.keys.countP (fun x : Key => decide ((x : WithTop Key) < r.begin.key)) = s - 1
|
||||
rw [hkeys₂, List.countP_append, List.countP_append, List.countP_append]
|
||||
have hHc : dbH.keys.countP
|
||||
(fun x : Key => decide ((x : WithTop Key) < r.begin.key)) = dbH.keys.length :=
|
||||
@@ -1492,7 +1494,8 @@ theorem minimal_completeForwardCrossedGeneral {r : RangeRead} {res : Result}
|
||||
⟨r.end_.key, (keyAfter (res.keys.getLastD ([] : Key)) : WithTop Key)⟩ :=
|
||||
minimal_truncatedRange_of_crossed_finite_general hread hmore hne hrev hbegin hcross
|
||||
hend2 (by simpa [reportedAtEnd, endOvershoot] using hte)
|
||||
rw [completeForwardCrossedGeneral, if_neg (by omega : ¬ r.end_.offset ≤ 1), if_pos hte]
|
||||
rw [completeForwardCrossedGeneral, ite_eq_right (by omega : ¬ r.end_.offset ≤ 1), ite_eq_left
|
||||
hte]
|
||||
exact hmin
|
||||
· have htlt : reportedAtEnd r res + (r.begin.offset - 1).toNat < endOvershoot r :=
|
||||
lt_of_le_of_ne htle hte
|
||||
@@ -1508,8 +1511,8 @@ theorem minimal_completeForwardCrossedGeneral {r : RangeRead} {res : Result}
|
||||
have hmin : Minimal r res ⟨r.end_.key, ⊤⟩ :=
|
||||
minimal_topRange_of_crossed_large_room_general hread hmore hrev hne hbegin hcross
|
||||
hend2 htb hroom'
|
||||
rw [completeForwardCrossedGeneral, if_neg (by omega : ¬ r.end_.offset ≤ 1),
|
||||
if_neg hte, if_pos hroom]
|
||||
rw [completeForwardCrossedGeneral, ite_eq_right (by omega : ¬ r.end_.offset ≤ 1),
|
||||
ite_eq_right hte, ite_eq_left hroom]
|
||||
exact hmin
|
||||
· have hroom' : intervalCard r.end_.key r.begin.key <
|
||||
(((r.end_.offset - 1).toNat - res.keys.length -
|
||||
@@ -1518,8 +1521,8 @@ theorem minimal_completeForwardCrossedGeneral {r : RangeRead} {res : Result}
|
||||
have hmin : Minimal r res ⟨r.begin.key, ⊤⟩ :=
|
||||
minimal_topRange_of_crossed_small_room_general hread hmore hne hrev hbegin hcross
|
||||
hend2 htb hroom'
|
||||
rw [completeForwardCrossedGeneral, if_neg (by omega : ¬ r.end_.offset ≤ 1),
|
||||
if_neg hte, if_neg hroom]
|
||||
rw [completeForwardCrossedGeneral, ite_eq_right (by omega : ¬ r.end_.offset ≤ 1),
|
||||
ite_eq_right hte, ite_eq_right hroom]
|
||||
exact hmin
|
||||
|
||||
end FormalConflictRange
|
||||
|
||||
Reference in new issue
Block a user