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
@@ -235,7 +235,8 @@ theorem compatible_crossed_iff_endKeyToBegin_of_room {r : RangeRead} {res : Resu
|
||||
have hgap_le : ((db.keys.countP (fun k : Key => decide ((k : WithTop Key) < r.begin.key)) -
|
||||
db.keys.countP (fun k : Key => decide ((k : WithTop Key) < r.end_.key)) : ℕ) : ℕ∞) ≤
|
||||
intervalCard r.end_.key r.begin.key := by
|
||||
simpa [cnt] using cnt_sub_le_intervalCard (db := db) (w₁ := r.end_.key) (w₂ := r.begin.key) (le_of_lt hcross)
|
||||
simpa [cnt] using cnt_sub_le_intervalCard (db := db) (w₁ := r.end_.key) (w₂ := r.begin.key)
|
||||
(le_of_lt hcross)
|
||||
-- gap plus reported length stays below the end offset budget
|
||||
rw [htlen] at hroom
|
||||
have hgap_lt : (db.keys.countP (fun k : Key => decide ((k : WithTop Key) < r.begin.key)) -
|
||||
@@ -547,7 +548,7 @@ theorem necessary_of_mem_interval_crossed_top {r : RangeRead} {res : Result} {k
|
||||
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 [hdb₂, List.countP_append, List.countP_append]
|
||||
have hHc : dbH.keys.countP
|
||||
(fun x : Key => decide ((x : WithTop Key) < r.begin.key)) = dbH.keys.length :=
|
||||
@@ -761,8 +762,8 @@ theorem minimal_completeForward_of_crossed {r : RangeRead} {res : Result}
|
||||
hend2 (by simpa [reportedAtEnd, endOvershoot] using hte)
|
||||
have hs0 : gapOvershoot r res = 0 := by
|
||||
simp [gapOvershoot, hte]
|
||||
rw [completeForwardClosed, if_neg (by omega : ¬ r.end_.offset ≤ 1), if_pos hte]
|
||||
rw [if_pos (by refine ⟨hcross, ?_⟩; rw [hs0]; simp)]
|
||||
rw [completeForwardClosed, ite_eq_right (by omega : ¬ r.end_.offset ≤ 1), ite_eq_left hte]
|
||||
rw [ite_eq_left (by refine ⟨hcross, ?_⟩; rw [hs0]; simp)]
|
||||
exact hmin
|
||||
· have htlt : reportedAtEnd r res < endOvershoot r := lt_of_le_of_ne htle hte
|
||||
have htlt' : res.keys.countP (fun k : Key => decide (r.end_.key ≤ (k : WithTop Key))) <
|
||||
@@ -776,18 +777,19 @@ theorem minimal_completeForward_of_crossed {r : RangeRead} {res : Result}
|
||||
have hmin : Minimal r res ⟨r.end_.key, ⊤⟩ :=
|
||||
minimal_topRange_of_crossed_large_room hread hmore hrev hne hbegin hcross hend2
|
||||
htlt' hroom'
|
||||
rw [completeForwardClosed, if_neg (by omega : ¬ r.end_.offset ≤ 1), if_neg hte]
|
||||
rw [if_pos (by refine ⟨hcross, ?_⟩; exact hroom)]
|
||||
rw [completeForwardClosed, ite_eq_right (by omega : ¬ r.end_.offset ≤ 1), ite_eq_right hte]
|
||||
rw [ite_eq_left (by refine ⟨hcross, ?_⟩; exact hroom)]
|
||||
exact hmin
|
||||
· have hroom' : intervalCard r.end_.key r.begin.key <
|
||||
((((r.end_.offset - 1).toNat -
|
||||
res.keys.countP (fun k : Key => decide (r.end_.key ≤ (k : WithTop Key))) : ℕ) : ℕ∞)) := by
|
||||
res.keys.countP (fun k : Key => decide (r.end_.key ≤ (k : WithTop Key))) : ℕ) : ℕ∞))
|
||||
:= by
|
||||
simpa [gapOvershoot, endOvershoot, reportedAtEnd] using lt_of_not_ge hroom
|
||||
have hmin : Minimal r res ⟨r.begin.key, ⊤⟩ :=
|
||||
minimal_topRange_of_crossed_small_room hread hmore hne hrev hbegin hcross hend2
|
||||
htlt' hroom'
|
||||
rw [completeForwardClosed, if_neg (by omega : ¬ r.end_.offset ≤ 1), if_neg hte]
|
||||
rw [if_neg (by intro h; exact hroom h.2)]
|
||||
rw [completeForwardClosed, ite_eq_right (by omega : ¬ r.end_.offset ≤ 1), ite_eq_right hte]
|
||||
rw [ite_eq_right (by intro h; exact hroom h.2)]
|
||||
exact hmin
|
||||
|
||||
/-- The reversed-traversal analogue of `completeForwardClosed`: the upper endpoint is
|
||||
@@ -844,10 +846,10 @@ theorem completeForwardClosed_eq_closedFormOffsetOne {r : RangeRead} {res : Resu
|
||||
completeForwardClosed r res = closedFormOffsetOne r res := by
|
||||
unfold completeForwardClosed closedFormOffsetOne
|
||||
by_cases h : r.end_.offset ≤ 1
|
||||
· rw [if_pos h, if_pos h]
|
||||
· rw [if_neg h, if_neg h]
|
||||
· rw [ite_eq_left h, ite_eq_left h]
|
||||
· rw [ite_eq_right h, ite_eq_right h]
|
||||
have hnc : ¬ r.end_.key < r.begin.key := not_lt.mpr hcross
|
||||
simp only [hnc, false_and, if_false]
|
||||
simp only [hnc, false_and, ite_false]
|
||||
rfl
|
||||
|
||||
/-- On cross-free selectors the unified reversed rule is the existing compact
|
||||
@@ -857,10 +859,10 @@ theorem completeReversedClosed_eq_closedFormOffsetOneRev {r : RangeRead} {res :
|
||||
completeReversedClosed r res = closedFormOffsetOneRev r res := by
|
||||
unfold completeReversedClosed closedFormOffsetOneRev
|
||||
by_cases h : r.end_.offset ≤ 1
|
||||
· rw [if_pos h, if_pos h]
|
||||
· rw [if_neg h, if_neg h]
|
||||
· rw [ite_eq_left h, ite_eq_left h]
|
||||
· rw [ite_eq_right h, ite_eq_right h]
|
||||
have hnc : ¬ r.end_.key < r.begin.key := not_lt.mpr hcross
|
||||
simp only [hnc, false_and, if_false]
|
||||
simp only [hnc, false_and, ite_false]
|
||||
rfl
|
||||
|
||||
/-- The complete closed-form rule at begin offset one, dispatching on traversal order. -/
|
||||
@@ -875,13 +877,13 @@ theorem minimal_completeClosed {r : RangeRead} {res : Result}
|
||||
Minimal r res (completeClosed r res) := by
|
||||
unfold completeClosed
|
||||
by_cases hrev : r.reverse = true
|
||||
· rw [if_pos hrev]
|
||||
· rw [ite_eq_left hrev]
|
||||
by_cases hcross : r.end_.key < r.begin.key
|
||||
· exact minimal_completeReversed_of_crossed hread hmore hne hrev hbegin hcross
|
||||
· have hcf : r.begin.key ≤ r.end_.key := not_lt.mp hcross
|
||||
rw [completeReversedClosed_eq_closedFormOffsetOneRev hcf]
|
||||
exact minimal_closedForm_of_offset_one_rev hread hmore hne hrev hbegin hcf
|
||||
· rw [if_neg hrev]
|
||||
· rw [ite_eq_right hrev]
|
||||
have hrevf : r.reverse = false := by
|
||||
cases hr : r.reverse <;> simp_all
|
||||
by_cases hcross : r.end_.key < r.begin.key
|
||||
|
||||
Reference in new issue
Block a user