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
@@ -45,7 +45,7 @@ theorem countAtWith_eq_pref (base : ℕ) {bounds : List Key} {counts : List ℕ}
|
||||
· exact absurd rfl hkb
|
||||
· exact hkbs
|
||||
rw [List.idxOf_cons_ne bs (fun h => hkb h.symm)]
|
||||
simp only [countAtWith, if_neg hkb]
|
||||
simp only [countAtWith, ite_eq_right hkb]
|
||||
rw [ih (base := base + d) hlen' hkbs]
|
||||
simp [pref, List.take_succ_cons, List.sum_cons]
|
||||
omega
|
||||
@@ -62,7 +62,7 @@ def capEdgesAux (start : Key) (bounds : List Key) (i : ℕ) : List DEdge :=
|
||||
| [] => []
|
||||
| b :: bs =>
|
||||
[⟨i + 1, i, 0⟩] ++
|
||||
(if h : intervalCard (start : WithTop Key) (b : WithTop Key) = ⊤ then []
|
||||
(if _h : intervalCard (start : WithTop Key) (b : WithTop Key) = ⊤ then []
|
||||
else [⟨i, i + 1, ((intervalCard (start : WithTop Key) (b : WithTop Key)).toNat : ℤ)⟩]) ++
|
||||
capEdgesAux b bs (i + 1)
|
||||
|
||||
@@ -169,7 +169,7 @@ theorem length_eq_of_countsFit {start : Key} {bounds : List Key} {counts : List
|
||||
| cons b bs ih =>
|
||||
cases counts with
|
||||
| nil => simp [CountsFit] at h
|
||||
| cons d ds => simp [CountsFit] at h; exact congrArg Nat.succ (ih h.2.2)
|
||||
| cons d ds => simp only [CountsFit] at h; exact congrArg Nat.succ (ih h.2.2)
|
||||
|
||||
/-- Capacity edges hold when the prefix-cumulative assignment comes from a
|
||||
capacity-fitting count list. -/
|
||||
@@ -197,7 +197,8 @@ theorem capEdgesAux_holds_of_countsFit {start : Key} {bounds : List Key}
|
||||
have hnonneg : x i - x (i + 1) ≤ 0 := by linarith [hhead]
|
||||
have hcapEdge : HoldsAll x
|
||||
(if h : intervalCard (start : WithTop Key) (b : WithTop Key) = ⊤ then []
|
||||
else [⟨i, i + 1, ((intervalCard (start : WithTop Key) (b : WithTop Key)).toNat : ℤ)⟩]) := by
|
||||
else [⟨i, i + 1, ((intervalCard (start : WithTop Key) (b : WithTop Key)).toNat :
|
||||
ℤ)⟩]) := by
|
||||
by_cases htop : intervalCard (start : WithTop Key) (b : WithTop Key) = ⊤
|
||||
· simp [htop, HoldsAll]
|
||||
· intro e he
|
||||
@@ -269,7 +270,7 @@ theorem countsFit_of_capEdgesAux {start : Key} {bounds : List Key}
|
||||
/-- Evaluation of the count environment is the corresponding cumulative variable. -/
|
||||
theorem evalCount_eq_countsToX {bounds : List Key} {counts : List ℕ}
|
||||
{topCount : ℕ} (hlen : counts.length = bounds.length)
|
||||
(hnoBot : ([] : Key) ∉ bounds) {e : WithTop Key}
|
||||
(_hnoBot : ([] : Key) ∉ bounds) {e : WithTop Key}
|
||||
(he : EndpointCovered e bounds) :
|
||||
evalCount bounds counts topCount e =
|
||||
countsToX bounds.length counts topCount (endpointIndex bounds e) := by
|
||||
@@ -287,7 +288,7 @@ theorem evalCount_eq_countsToX {bounds : List Key} {counts : List ℕ}
|
||||
have hlook := countAtWith_eq_pref (base := 0) hlen' hk
|
||||
have hne : bounds.idxOf k ≠ bounds.length := by omega
|
||||
have hnot : k ≠ ([] : Key) := hkbot
|
||||
simp [evalCount, countsToX, endpointIndex, hkbot, hnot, hne, hlook]
|
||||
simp [evalCount, countsToX, endpointIndex, hkbot, hne, hlook]
|
||||
|
||||
|
||||
/-- The toggled count environment is the untoggled one plus the toggle coefficient,
|
||||
@@ -308,7 +309,7 @@ theorem evalCountToggled_eq_add_toggleCoeff {bounds : List Key} {counts : List
|
||||
constraint system. -/
|
||||
theorem constraintEdges_holds_iff {bounds : List Key} {counts : List ℕ}
|
||||
{topCount : ℕ} {S : ConstraintSystem}
|
||||
(hlen : counts.length = bounds.length) {x : ℕ → ℤ}
|
||||
(_hlen : counts.length = bounds.length) {x : ℕ → ℤ}
|
||||
(hx : ∀ e : WithTop Key, EndpointCovered e bounds → x (endpointIndex bounds e) =
|
||||
evalCount bounds counts topCount e)
|
||||
(hcover : ∀ c ∈ S, EndpointCovered c.lo bounds ∧ EndpointCovered c.hi bounds) :
|
||||
@@ -406,7 +407,7 @@ theorem prefixCum_diffCounts {x : ℕ → ℤ} (h0 : x 0 = 0) (n : ℕ)
|
||||
intro k hk
|
||||
have hk0 : k = 0 := by simpa [diffCounts] using hk
|
||||
subst k
|
||||
simp [PrefixCum, h0, pref]
|
||||
simp [ h0, pref]
|
||||
| succ n ih =>
|
||||
intro k hk
|
||||
have hk' : k ≤ n + 1 := by simpa [diffCounts_length] using hk
|
||||
@@ -422,7 +423,7 @@ theorem prefixCum_diffCounts {x : ℕ → ℤ} (h0 : x 0 = 0) (n : ℕ)
|
||||
rw [diffCounts_length]]
|
||||
rw [pref_append_singleton_self, pref_length, diffCounts_length]
|
||||
have hprev := ih (fun i hi => hnonneg i (by omega)) n
|
||||
(by simpa [diffCounts_length] using le_refl n)
|
||||
(by simp [diffCounts_length])
|
||||
have hprefsum : pref (diffCounts x n) n = (diffCounts x n).sum :=
|
||||
pref_eq_sum_of_length_le (by rw [diffCounts_length])
|
||||
have hprev' : x n - x 0 = ((diffCounts x n).sum : ℤ) := by
|
||||
@@ -448,7 +449,7 @@ theorem eq_countsToX_of_prefixCum {x : ℕ → ℤ} {counts : List ℕ} {n topCo
|
||||
intro i hi
|
||||
by_cases hin : i = n + 1
|
||||
· subst i
|
||||
simp only [countsToX, if_pos rfl]
|
||||
simp only [countsToX]
|
||||
have hsum : x n = (pref counts n : ℤ) := by
|
||||
have := hpref n (by omega)
|
||||
simpa [h0] using this
|
||||
@@ -467,7 +468,7 @@ theorem eq_countsToX_of_prefixCum {x : ℕ → ℤ} {counts : List ℕ} {n topCo
|
||||
ring
|
||||
· have hi' : i ≤ n := by omega
|
||||
have hne : i ≠ n + 1 := hin
|
||||
simp only [countsToX, if_neg hne]
|
||||
simp only [countsToX, ite_eq_right hne]
|
||||
have := hpref i (by omega)
|
||||
simpa [h0] using this
|
||||
|
||||
@@ -511,8 +512,7 @@ theorem branchEqEdges_holds_iff {bounds : List Key} {counts : List ℕ}
|
||||
simp only [DEdge.Holds] at h1 h2
|
||||
rw [hxi, hxj] at h1 h2
|
||||
linarith
|
||||
· intro h
|
||||
intro e he
|
||||
· intro h e he
|
||||
simp only [List.mem_cons, List.not_mem_nil, or_false] at he
|
||||
rcases he with rfl | rfl
|
||||
· simp only [DEdge.Holds]
|
||||
@@ -537,8 +537,7 @@ theorem branchEqEdges_holds_iff {bounds : List Key} {counts : List ℕ}
|
||||
simp only [DEdge.Holds] at h1 h2
|
||||
rw [hxi, hxj] at h1 h2
|
||||
linarith
|
||||
· intro h
|
||||
intro e he
|
||||
· intro h e he
|
||||
simp only [List.mem_cons, List.not_mem_nil, or_false] at he
|
||||
rcases he with rfl | rfl
|
||||
· simp only [DEdge.Holds]
|
||||
@@ -599,11 +598,11 @@ theorem countFeasibleBranch_iff_diffFeasible
|
||||
simp only [DEdge.Holds]
|
||||
have hxn : x bounds.length = (counts.sum : ℤ) := by
|
||||
dsimp [x]
|
||||
rw [countsToX, if_neg (by omega)]
|
||||
rw [countsToX, ite_eq_right (by omega)]
|
||||
rw [pref_eq_sum_of_length_le (l := counts) (n := bounds.length) (by omega)]
|
||||
have hxt : x (bounds.length + 1) = ((counts.sum + topCount : ℕ) : ℤ) := by
|
||||
dsimp [x]
|
||||
rw [countsToX, if_pos rfl]
|
||||
rw [countsToX, ite_eq_left rfl]
|
||||
push_cast
|
||||
ring
|
||||
rw [hxn, hxt]
|
||||
@@ -695,7 +694,7 @@ theorem countFeasibleBranch_iff_diffFeasible
|
||||
intro hbot
|
||||
exact hnoBot (hbot ▸ ha)
|
||||
have hlt : bounds.idxOf a < bounds.length := List.idxOf_lt_length_iff.mpr ha
|
||||
simp only [endpointIndex, ha', if_false]
|
||||
simp only [endpointIndex, ha', ite_false]
|
||||
omega
|
||||
rw [hyAgree _ hidx]
|
||||
exact (evalCount_eq_countsToX hlen hnoBot he).symm
|
||||
@@ -727,8 +726,8 @@ branches. -/
|
||||
theorem countFeasible_iff_branch_or
|
||||
(bounds : List Key) (k : Key) (S : ConstraintSystem) (bad : List Constraint)
|
||||
(hnoBot : ([] : Key) ∉ bounds)
|
||||
(hcoverS : ∀ c ∈ S, EndpointCovered c.lo bounds ∧ EndpointCovered c.hi bounds)
|
||||
(hcoverBad : ∀ c ∈ bad, EndpointCovered c.lo bounds ∧ EndpointCovered c.hi bounds)
|
||||
(_hcoverS : ∀ c ∈ S, EndpointCovered c.lo bounds ∧ EndpointCovered c.hi bounds)
|
||||
(_hcoverBad : ∀ c ∈ bad, EndpointCovered c.lo bounds ∧ EndpointCovered c.hi bounds)
|
||||
(hk : k = ([] : Key) ∨ k ∈ bounds) (hka : keyAfter k ∈ bounds) :
|
||||
CountFeasible bounds k S bad ↔
|
||||
CountFeasibleBranch bounds k true S bad ∨
|
||||
|
||||
Reference in new issue
Block a user