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
@@ -241,7 +241,7 @@ theorem compatible_anchor_of_zero_crossed {db : DB} {r : RangeRead} {res : Resul
|
||||
rw [hL]
|
||||
congr 1
|
||||
funext k
|
||||
show decide (((res.keys.head hne : Key) : WithTop Key) ≤ (k : WithTop Key) ∧
|
||||
change decide (((res.keys.head hne : Key) : WithTop Key) ≤ (k : WithTop Key) ∧
|
||||
(k : WithTop Key) < resolve db r.end_) =
|
||||
decide (resolve db (zeroBeginAnchor r res).begin ≤ (k : WithTop Key) ∧
|
||||
(k : WithTop Key) < resolve db r.end_)
|
||||
@@ -285,7 +285,7 @@ theorem compatible_of_anchor_of_no_between {db : DB} {r : RangeRead} {res : Resu
|
||||
rw [hL]
|
||||
congr 1
|
||||
funext k
|
||||
show decide (((res.keys.head hne : Key) : WithTop Key) ≤ (k : WithTop Key) ∧
|
||||
change decide (((res.keys.head hne : Key) : WithTop Key) ≤ (k : WithTop Key) ∧
|
||||
(k : WithTop Key) < resolve db r.end_) =
|
||||
decide (resolve db (zeroBeginAnchor r res).begin ≤ (k : WithTop Key) ∧
|
||||
(k : WithTop Key) < resolve db r.end_)
|
||||
@@ -328,7 +328,8 @@ theorem sound_of_anchor_sound {r : RangeRead} {res : Result} {cr crA : ConflictR
|
||||
intro k hk hkb
|
||||
have hno_db := no_stored_between_head_begin_of_zero_crossed hc hrev hmore hne
|
||||
hbegin hcross
|
||||
have hkbd : k ∈ db.keys := ((agreeOn_iff cr db db').mp hag) k (hmem_cr k hkb.1 hkb.2) |>.mpr hk
|
||||
have hkbd : k ∈ db.keys := ((agreeOn_iff cr db db').mp hag) k (hmem_cr k hkb.1 hkb.2) |>.mpr
|
||||
hk
|
||||
exact hno_db k hkbd hkb
|
||||
exact compatible_of_anchor_of_no_between hcA' hrev hmore hne hbegin hcross hno
|
||||
constructor
|
||||
@@ -387,7 +388,7 @@ theorem minimal_zeroCrossLongAnchor {r : RangeRead} {res : Result}
|
||||
(hread : Readable r res) (hrev : r.reverse = false) (hmore : res.more = false)
|
||||
(hne : res.keys ≠ []) (hbegin : r.begin.offset = 0)
|
||||
(hcross : ((res.keys.head hne : Key) : WithTop Key) < r.begin.key)
|
||||
(hend : 2 ≤ r.end_.offset) :
|
||||
(_hend : 2 ≤ r.end_.offset) :
|
||||
Minimal (zeroBeginAnchor r res) res (zeroCrossLongAnchor r res) := by
|
||||
obtain ⟨db₀, hcomp₀⟩ := hread
|
||||
have hH : res.keys.headD ([] : Key) = res.keys.head hne := headD_eq_head_sound hne
|
||||
@@ -398,13 +399,13 @@ theorem minimal_zeroCrossLongAnchor {r : RangeRead} {res : Result}
|
||||
unfold zeroCrossLongAnchor
|
||||
rw [hH]
|
||||
by_cases hE : r.end_.key < ((res.keys.head hne : Key) : WithTop Key)
|
||||
· rw [if_pos hE]
|
||||
· rw [ite_eq_left hE]
|
||||
have hEA : (zeroBeginAnchor r res).end_.key < (zeroBeginAnchor r res).begin.key := by
|
||||
change r.end_.key < (zeroBeginAnchor r res).begin.key
|
||||
rw [zeroBeginAnchor_begin_zero_cross_long r res hne]
|
||||
exact hE
|
||||
exact minimal_completeForwardCrossedGeneral hreadA hmore hne hrevA (by omega) hEA
|
||||
· rw [if_neg hE]
|
||||
· rw [ite_eq_right hE]
|
||||
have hle : ((res.keys.head hne : Key) : WithTop Key) ≤ r.end_.key := not_lt.mp hE
|
||||
have hleA : (zeroBeginAnchor r res).begin.key ≤ (zeroBeginAnchor r res).end_.key := by
|
||||
change (zeroBeginAnchor r res).begin.key ≤ r.end_.key
|
||||
@@ -444,7 +445,7 @@ theorem zeroBeginAnchor_begin_offset_eq (r : RangeRead) (res : Result) :
|
||||
|
||||
/-- The begin endpoint of the long-cell anchor, with `E < H`. -/
|
||||
theorem zeroCrossLongAnchor_begin_crossed {r : RangeRead} {res : Result}
|
||||
(hne : res.keys ≠ []) (hbegin : r.begin.offset = 0) (hend : 2 ≤ r.end_.offset)
|
||||
(hne : res.keys ≠ []) (_hbegin : r.begin.offset = 0) (hend : 2 ≤ r.end_.offset)
|
||||
(hEH : r.end_.key < ((res.keys.head hne : Key) : WithTop Key)) :
|
||||
(zeroCrossLongAnchor r res).begin =
|
||||
if reportedAtEnd r res = endOvershoot r ∨
|
||||
@@ -452,17 +453,17 @@ theorem zeroCrossLongAnchor_begin_crossed {r : RangeRead} {res : Result}
|
||||
intervalCard r.end_.key ((res.keys.head hne : Key) : WithTop Key))
|
||||
then r.end_.key else ((res.keys.head hne : Key) : WithTop Key) := by
|
||||
unfold zeroCrossLongAnchor
|
||||
rw [headD_eq_head_sound hne, if_pos hEH]
|
||||
rw [headD_eq_head_sound hne, ite_eq_left hEH]
|
||||
show (completeForwardCrossedGeneral (zeroBeginAnchor r res) res).begin = _
|
||||
unfold completeForwardCrossedGeneral
|
||||
rw [if_neg (by rw [zeroBeginAnchor_end_offset_eq]; omega)]
|
||||
rw [ite_eq_right (by rw [zeroBeginAnchor_end_offset_eq]; omega)]
|
||||
rw [zeroBeginAnchor_reported_eq, zeroBeginAnchor_overshoot_eq,
|
||||
zeroBeginAnchor_begin_offset_eq, show (((1 : ℤ) - 1).toNat) = 0 by norm_num,
|
||||
Nat.add_zero, zeroBeginAnchor_begin_key_eq r res hne]
|
||||
rw [zeroBeginAnchor_interval_eq]
|
||||
by_cases ht : reportedAtEnd r res = endOvershoot r
|
||||
· rw [if_pos ht, if_pos (Or.inl ht), zeroBeginAnchor_end_key_eq]
|
||||
· rw [if_neg ht]
|
||||
· rw [ite_eq_left ht, ite_eq_left (Or.inl ht), zeroBeginAnchor_end_key_eq]
|
||||
· rw [ite_eq_right ht]
|
||||
have hso : crossedOvershootGeneral (zeroBeginAnchor r res) res =
|
||||
endOvershoot r - reportedAtEnd r res := by
|
||||
unfold crossedOvershootGeneral
|
||||
@@ -472,58 +473,58 @@ theorem zeroCrossLongAnchor_begin_crossed {r : RangeRead} {res : Result}
|
||||
rw [hso]
|
||||
by_cases hc : (((endOvershoot r - reportedAtEnd r res : ℕ) : ℕ∞) ≤
|
||||
intervalCard r.end_.key ((res.keys.head hne : Key) : WithTop Key))
|
||||
· rw [if_pos hc, if_pos (Or.inr hc), zeroBeginAnchor_end_key_eq]
|
||||
· rw [if_neg hc, if_neg (fun h => h.elim ht hc)]
|
||||
· rw [ite_eq_left hc, ite_eq_left (Or.inr hc), zeroBeginAnchor_end_key_eq]
|
||||
· rw [ite_eq_right hc, ite_eq_right (fun h => h.elim ht hc)]
|
||||
|
||||
/-- The end endpoint of the long-cell anchor, with `E < H`. -/
|
||||
theorem zeroCrossLongAnchor_end_crossed {r : RangeRead} {res : Result}
|
||||
(hne : res.keys ≠ []) (hbegin : r.begin.offset = 0) (hend : 2 ≤ r.end_.offset)
|
||||
(hne : res.keys ≠ []) (_hbegin : r.begin.offset = 0) (hend : 2 ≤ r.end_.offset)
|
||||
(hEH : r.end_.key < ((res.keys.head hne : Key) : WithTop Key)) :
|
||||
(zeroCrossLongAnchor r res).end_ =
|
||||
if reportedAtEnd r res = endOvershoot r
|
||||
then (((keyAfter (res.keys.getLastD ([] : Key)) : Key)) : WithTop Key) else ⊤ := by
|
||||
unfold zeroCrossLongAnchor
|
||||
rw [headD_eq_head_sound hne, if_pos hEH]
|
||||
rw [headD_eq_head_sound hne, ite_eq_left hEH]
|
||||
show (completeForwardCrossedGeneral (zeroBeginAnchor r res) res).end_ = _
|
||||
unfold completeForwardCrossedGeneral
|
||||
rw [if_neg (by rw [zeroBeginAnchor_end_offset_eq]; omega)]
|
||||
rw [ite_eq_right (by rw [zeroBeginAnchor_end_offset_eq]; omega)]
|
||||
rw [zeroBeginAnchor_reported_eq, zeroBeginAnchor_overshoot_eq,
|
||||
zeroBeginAnchor_begin_offset_eq, show (((1 : ℤ) - 1).toNat) = 0 by norm_num,
|
||||
Nat.add_zero]
|
||||
by_cases ht : reportedAtEnd r res = endOvershoot r
|
||||
· rw [if_pos ht, if_pos ht]
|
||||
· rw [if_neg ht, if_neg ht]
|
||||
· rw [ite_eq_left ht, ite_eq_left ht]
|
||||
· rw [ite_eq_right ht, ite_eq_right ht]
|
||||
|
||||
/-- The begin endpoint of the long-cell anchor, with `H ≤ E`. -/
|
||||
theorem zeroCrossLongAnchor_begin_crossfree {r : RangeRead} {res : Result}
|
||||
(hne : res.keys ≠ []) (hbegin : r.begin.offset = 0) (hend : 2 ≤ r.end_.offset)
|
||||
(hne : res.keys ≠ []) (_hbegin : r.begin.offset = 0) (hend : 2 ≤ r.end_.offset)
|
||||
(hEH : ¬ (r.end_.key < ((res.keys.head hne : Key) : WithTop Key))) :
|
||||
(zeroCrossLongAnchor r res).begin = (((res.keys.head hne : Key)) : WithTop Key) := by
|
||||
unfold zeroCrossLongAnchor
|
||||
rw [headD_eq_head_sound hne, if_neg hEH]
|
||||
rw [headD_eq_head_sound hne, ite_eq_right hEH]
|
||||
show (closedFormOffsetOne (zeroBeginAnchor r res) res).begin = _
|
||||
unfold closedFormOffsetOne
|
||||
rw [if_neg (by rw [zeroBeginAnchor_end_offset_eq]; omega)]
|
||||
rw [ite_eq_right (by rw [zeroBeginAnchor_end_offset_eq]; omega)]
|
||||
by_cases ht : res.keys.countP
|
||||
(fun k : Key => decide ((zeroBeginAnchor r res).end_.key ≤ (k : WithTop Key))) =
|
||||
((zeroBeginAnchor r res).end_.offset - 1).toNat
|
||||
· rw [if_pos ht]
|
||||
· rw [ite_eq_left ht]
|
||||
simp [truncatedRange, zeroBeginAnchor_begin_key_eq r res hne]
|
||||
· rw [if_neg ht]
|
||||
· rw [ite_eq_right ht]
|
||||
simp [topRange, zeroBeginAnchor_begin_key_eq r res hne]
|
||||
|
||||
/-- The end endpoint of the long-cell anchor, with `H ≤ E`. -/
|
||||
theorem zeroCrossLongAnchor_end_crossfree {r : RangeRead} {res : Result}
|
||||
(hne : res.keys ≠ []) (hbegin : r.begin.offset = 0) (hend : 2 ≤ r.end_.offset)
|
||||
(hne : res.keys ≠ []) (_hbegin : r.begin.offset = 0) (hend : 2 ≤ r.end_.offset)
|
||||
(hEH : ¬ (r.end_.key < ((res.keys.head hne : Key) : WithTop Key))) :
|
||||
(zeroCrossLongAnchor r res).end_ =
|
||||
if reportedAtEnd r res = endOvershoot r
|
||||
then (((keyAfter (res.keys.getLastD ([] : Key)) : Key)) : WithTop Key) else ⊤ := by
|
||||
unfold zeroCrossLongAnchor
|
||||
rw [headD_eq_head_sound hne, if_neg hEH]
|
||||
rw [headD_eq_head_sound hne, ite_eq_right hEH]
|
||||
show (closedFormOffsetOne (zeroBeginAnchor r res) res).end_ = _
|
||||
unfold closedFormOffsetOne
|
||||
rw [if_neg (by rw [zeroBeginAnchor_end_offset_eq]; omega)]
|
||||
rw [ite_eq_right (by rw [zeroBeginAnchor_end_offset_eq]; omega)]
|
||||
have hcnt : res.keys.countP
|
||||
(fun k : Key => decide ((zeroBeginAnchor r res).end_.key ≤ (k : WithTop Key))) =
|
||||
res.keys.countP (fun k : Key => decide (r.end_.key ≤ (k : WithTop Key))) := by
|
||||
@@ -533,9 +534,9 @@ theorem zeroCrossLongAnchor_end_crossfree {r : RangeRead} {res : Result}
|
||||
by_cases ht : res.keys.countP
|
||||
(fun k : Key => decide ((zeroBeginAnchor r res).end_.key ≤ (k : WithTop Key))) =
|
||||
((zeroBeginAnchor r res).end_.offset - 1).toNat
|
||||
· rw [if_pos ht, if_pos (by unfold reportedAtEnd; rw [← hcnt, ← hoff]; exact ht)]
|
||||
· rw [ite_eq_left ht, ite_eq_left (by unfold reportedAtEnd; rw [← hcnt, ← hoff]; exact ht)]
|
||||
simp [truncatedRange]
|
||||
· rw [if_neg ht, if_neg (by unfold reportedAtEnd; rw [← hcnt, ← hoff]; exact ht)]
|
||||
· rw [ite_eq_right ht, ite_eq_right (by unfold reportedAtEnd; rw [← hcnt, ← hoff]; exact ht)]
|
||||
simp [topRange]
|
||||
|
||||
/-- At `begin.offset = 0` and `begin.key = ⊤`, the begin selector resolves to the
|
||||
@@ -1043,14 +1044,14 @@ theorem minimal_closedForm_of_zero_cross_long_top {r : RangeRead} {res : Result}
|
||||
conv_lhs => rw [hsingle]
|
||||
by_cases hEH : r.end_.key ≤ ((res.keys.head hne : Key) : WithTop Key) <;> simp [hEH]
|
||||
unfold closedFormZeroCrossLong
|
||||
rw [if_pos htop, hHd]
|
||||
rw [ite_eq_left htop, hHd]
|
||||
dsimp only
|
||||
rw [ht]
|
||||
by_cases hcond : r.end_.key < ((res.keys.head hne : Key) : WithTop Key) ∧
|
||||
(((r.end_.offset - 1).toNat : ℕ∞) -
|
||||
((if r.end_.key ≤ ((res.keys.head hne : Key) : WithTop Key) then 1 else 0 : ℕ) : ℕ∞))
|
||||
< intervalCard r.end_.key ((res.keys.head hne : Key) : WithTop Key)
|
||||
· rw [if_pos hcond]
|
||||
· rw [ite_eq_left hcond]
|
||||
have hcle : r.end_.key ≤ ((res.keys.head hne : Key) : WithTop Key) := le_of_lt hcond.1
|
||||
have ht1 : res.keys.countP
|
||||
(fun k : Key => decide (r.end_.key ≤ (k : WithTop Key))) = 1 := by
|
||||
@@ -1065,7 +1066,7 @@ theorem minimal_closedForm_of_zero_cross_long_top {r : RangeRead} {res : Result}
|
||||
refine minimal_iff_sound_and_necessaryRange.mpr
|
||||
⟨sound_zero_cross_long_top_E hread hrev hmore hne hbegin htop hend hcond.1,
|
||||
necessary_zero_cross_long_top_E hread hrev hmore hne hbegin htop hend hcond.1 hcond'⟩
|
||||
· rw [if_neg hcond]
|
||||
· rw [ite_eq_right hcond]
|
||||
have hepos : 1 ≤ (r.end_.offset - 1).toNat := by omega
|
||||
have hbound : intervalCard r.end_.key ((res.keys.head hne : Key) : WithTop Key) + 1 ≤
|
||||
(((r.end_.offset - 1).toNat : ℕ) : ℕ∞) := by
|
||||
@@ -1333,7 +1334,7 @@ theorem necessary_zero_cross_long_below_head_eq {r : RangeRead} {res : Result} {
|
||||
(hread : Readable r res) (hrev : r.reverse = false) (hmore : res.more = false)
|
||||
(hne : res.keys ≠ []) (hbegin : r.begin.offset = 0)
|
||||
(hcross : ((res.keys.head hne : Key) : WithTop Key) < r.begin.key)
|
||||
(hlong : r.end_.key < r.begin.key) (hend : 2 ≤ r.end_.offset)
|
||||
(_hlong : r.end_.key < r.begin.key) (hend : 2 ≤ r.end_.offset)
|
||||
(hte : reportedAtEnd r res = endOvershoot r)
|
||||
(hEH : r.end_.key < ((res.keys.head hne : Key) : WithTop Key))
|
||||
(hkE : r.end_.key ≤ (k : WithTop Key))
|
||||
@@ -1344,7 +1345,8 @@ theorem necessary_zero_cross_long_below_head_eq {r : RangeRead} {res : Result} {
|
||||
let db : DB := ⟨res.keys, hsort⟩
|
||||
have hcompR : RangeRead.Compatible db r res :=
|
||||
compatible_res_keys_zero_cross_long hsort hread' hrev hmore hne hbegin hcross hend
|
||||
have hhead_le : ∀ q ∈ res.keys, ((res.keys.head hne : Key) : WithTop Key) ≤ (q : WithTop Key) := by
|
||||
have hhead_le : ∀ q ∈ res.keys, ((res.keys.head hne : Key) : WithTop Key) ≤ (q : WithTop Key) :=
|
||||
by
|
||||
intro q hq
|
||||
have := (hsort.pairwise.imp le_of_lt).rel_head hq
|
||||
simpa using this
|
||||
@@ -1415,7 +1417,8 @@ theorem necessary_zero_cross_long_below_head_eq {r : RangeRead} {res : Result} {
|
||||
exact htlen.symm.trans hte
|
||||
omega
|
||||
have hresle : resolve (toggle db k) r.end_ ≤ ((res.keys.getLast hne : Key) : WithTop Key) := by
|
||||
rcases resolve_eq_nil_or_eq_top_or_mem (db := toggle db k) (s := r.end_) with hn | ht' | ⟨q, hq, hqe⟩
|
||||
rcases resolve_eq_nil_or_eq_top_or_mem (db := toggle db k) (s := r.end_) with hn | ht' | ⟨q,
|
||||
hq, hqe⟩
|
||||
· rw [hn]; exact coe_nil_le_zero_cross_long _
|
||||
· exact absurd ht' hnot_top
|
||||
· rw [hqe]; exact WithTop.coe_le_coe.mpr (hmax q hq)
|
||||
@@ -1679,7 +1682,7 @@ theorem necessary_zero_cross_long_below_head_lt {r : RangeRead} {res : Result} {
|
||||
· exact hHnotin_res k ((hmem_dbH k).mpr (Or.inl rfl)) hkr
|
||||
· exact absurd hkC (lt_irrefl k)
|
||||
rw [List.append_assoc, List.erase_append,
|
||||
if_pos ((hmem_dbH k).mpr (Or.inl rfl)), hHerase]
|
||||
ite_eq_left ((hmem_dbH k).mpr (Or.inl rfl)), hHerase]
|
||||
simp [List.append_assoc]
|
||||
let dbErase : DB := dbBig.erase k
|
||||
have hkeysErase : dbErase.keys = dbH0.keys ++ res.keys ++ [C] := hEraseKeys
|
||||
@@ -1816,22 +1819,22 @@ theorem minimal_closedForm_of_zero_cross_long_finite {r : RangeRead} {res : Resu
|
||||
subrange_of_le le_rfl (le_max_left _ _)
|
||||
have hsound : Sound r res (closedFormZeroCrossLong r res) := by
|
||||
unfold closedFormZeroCrossLong
|
||||
rw [if_neg hB]
|
||||
rw [ite_eq_right hB]
|
||||
refine sound_of_anchor_sound hrev hmore hne hbegin hcross ?_ ?_ hsub hsoundA
|
||||
· by_cases hEH : r.end_.key < ((res.keys.head hne : Key) : WithTop Key)
|
||||
· rw [zeroCrossLongAnchor_begin_crossed hne hbegin hend hEH]
|
||||
by_cases hc : (reportedAtEnd r res = endOvershoot r ∨
|
||||
(((endOvershoot r - reportedAtEnd r res : ℕ) : ℕ∞) ≤
|
||||
intervalCard r.end_.key ((res.keys.head hne : Key) : WithTop Key)))
|
||||
· rw [if_pos hc]
|
||||
· rw [ite_eq_left hc]
|
||||
exact le_of_lt hEH
|
||||
· rw [if_neg hc]
|
||||
· rw [ite_eq_right hc]
|
||||
· rw [zeroCrossLongAnchor_begin_crossfree hne hbegin hend hEH]
|
||||
· exact le_max_right _ _
|
||||
refine minimal_iff_sound_and_necessaryRange.mpr ⟨hsound, ?_⟩
|
||||
intro k hklo hkhi
|
||||
unfold closedFormZeroCrossLong at hklo hkhi
|
||||
rw [if_neg hB] at hklo hkhi
|
||||
rw [ite_eq_right hB] at hklo hkhi
|
||||
dsimp only at hklo hkhi
|
||||
have htle := reportedAtEnd_le_endOvershoot_zero_cross_long hread hrev hmore hne hbegin
|
||||
hcross hend
|
||||
@@ -1845,9 +1848,9 @@ theorem minimal_closedForm_of_zero_cross_long_finite {r : RangeRead} {res : Resu
|
||||
by_cases hc : (reportedAtEnd r res = endOvershoot r ∨
|
||||
(((endOvershoot r - reportedAtEnd r res : ℕ) : ℕ∞) ≤
|
||||
intervalCard r.end_.key ((res.keys.head hne : Key) : WithTop Key)))
|
||||
· rw [zeroCrossLongAnchor_begin_crossed hne hbegin hend hEH, if_pos hc] at hklo
|
||||
· rw [zeroCrossLongAnchor_begin_crossed hne hbegin hend hEH, ite_eq_left hc] at hklo
|
||||
exact hklo
|
||||
· rw [zeroCrossLongAnchor_begin_crossed hne hbegin hend hEH, if_neg hc] at hklo
|
||||
· rw [zeroCrossLongAnchor_begin_crossed hne hbegin hend hEH, ite_eq_right hc] at hklo
|
||||
exact absurd hklo (not_le.mpr hkH)
|
||||
by_cases hte : reportedAtEnd r res = endOvershoot r
|
||||
· exact necessary_zero_cross_long_below_head_eq hsort hread hrev hmore hne hbegin
|
||||
@@ -1858,11 +1861,11 @@ theorem minimal_closedForm_of_zero_cross_long_finite {r : RangeRead} {res : Resu
|
||||
(((endOvershoot r - reportedAtEnd r res : ℕ) : ℕ∞) ≤
|
||||
intervalCard r.end_.key ((res.keys.head hne : Key) : WithTop Key)))
|
||||
· exact hc.resolve_left hte
|
||||
· rw [zeroCrossLongAnchor_begin_crossed hne hbegin hend hEH, if_neg hc] at hklo
|
||||
· rw [zeroCrossLongAnchor_begin_crossed hne hbegin hend hEH, ite_eq_right hc] at hklo
|
||||
exact absurd hklo (not_le.mpr hkH)
|
||||
exact necessary_zero_cross_long_below_head_lt hsort hread hrev hmore hne hbegin
|
||||
hcross hend (lt_of_le_of_ne htle hte) hEH hroom hB hkE hkH
|
||||
· push_neg at hkH
|
||||
· push Not at hkH
|
||||
by_cases hkB : (k : WithTop Key) < r.begin.key
|
||||
· by_cases hkHeq : ((res.keys.head hne : Key) : WithTop Key) = (k : WithTop Key)
|
||||
· have hkEq : k = res.keys.head hne := WithTop.coe_injective hkHeq.symm
|
||||
@@ -1871,20 +1874,20 @@ theorem minimal_closedForm_of_zero_cross_long_finite {r : RangeRead} {res : Resu
|
||||
lt_of_le_of_ne hkH hkHeq
|
||||
exact necessary_zero_cross_long_gap hsort hread hrev hmore hne hbegin hcross
|
||||
hend hHlt hkB
|
||||
· push_neg at hkB
|
||||
· push Not at hkB
|
||||
by_cases hkL : (k : WithTop Key) ≤
|
||||
((res.keys.getLast hne : Key) : WithTop Key)
|
||||
· exact necessary_zero_cross_long_between_last hread hne hcross hkB
|
||||
(WithTop.coe_le_coe.mp hkL)
|
||||
· push_neg at hkL
|
||||
· push Not at hkL
|
||||
have ht : reportedAtEnd r res < endOvershoot r := by
|
||||
by_contra hcon
|
||||
push_neg at hcon
|
||||
push Not at hcon
|
||||
have hte : reportedAtEnd r res = endOvershoot r := le_antisymm htle hcon
|
||||
have hltmax := hkhi
|
||||
rw [lt_max_iff] at hltmax
|
||||
rcases hltmax with hlt | hlt
|
||||
· rw [zeroCrossLongAnchor_end_eq r res hne hbegin hend, if_pos hte] at hlt
|
||||
· rw [zeroCrossLongAnchor_end_eq r res hne hbegin hend, ite_eq_left hte] at hlt
|
||||
exact absurd (lt_keyAfter_iff k (res.keys.getLast hne) |>.mp
|
||||
(WithTop.coe_lt_coe.mp hlt)) (not_le.mpr (WithTop.coe_lt_coe.mp hkL))
|
||||
· exact absurd hlt (not_lt.mpr hkB)
|
||||
|
||||
Reference in new issue
Block a user