Skip to content

Commit 52fdd96

Browse files
chore: tidy various files (#16132)
1 parent cf2e934 commit 52fdd96

File tree

26 files changed

+88
-98
lines changed

26 files changed

+88
-98
lines changed

Archive/Sensitivity.lean

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,11 @@ is necessary since otherwise `n • v` refers to the multiplication defined
279279
using only the addition of `V`. -/
280280

281281

282-
theorem f_squared : ∀ v : V n, (f n) (f n v) = (n : ℝ) • v := by
283-
induction' n with n IH _ <;> intro v
284-
· simp only [Nat.cast_zero, zero_smul]; rfl
285-
· cases v; rw [f_succ_apply, f_succ_apply]; simp [IH, add_smul (n : ℝ) 1, add_assoc, V]; abel
282+
theorem f_squared (v : V n) : (f n) (f n v) = (n : ℝ) • v := by
283+
induction n with
284+
| zero => simp only [Nat.cast_zero, zero_smul, f_zero, zero_apply]
285+
| succ n IH =>
286+
cases v; rw [f_succ_apply, f_succ_apply]; simp [IH, add_smul (n : ℝ) 1, add_assoc, V]; abel
286287

287288
/-! We now compute the matrix of `f` in the `e` basis (`p` is the line index,
288289
`q` the column index). -/

Counterexamples/Phillips.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,7 @@ theorem exists_discrete_support_nonpos (f : BoundedAdditiveMeasure α) :
296296
induction n with
297297
| zero =>
298298
simp only [s, BoundedAdditiveMeasure.empty, id, Nat.cast_zero, zero_mul,
299-
Function.iterate_zero, Subtype.coe_mk]
300-
rfl
299+
Function.iterate_zero, Subtype.coe_mk, le_rfl]
301300
| succ n IH =>
302301
have : (s (n + 1)).1 = (s (n + 1)).1 \ (s n).1 ∪ (s n).1 := by
303302
simpa only [s, Function.iterate_succ', union_diff_self]

Mathlib/Algebra/BigOperators/Group/Finset.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,11 +1527,11 @@ lemma prod_involution (g : ∀ a ∈ s, α) (hg₁ : ∀ a ha, f a * f (g a ha)
15271527
have : {x, g x hx} ⊆ s := by simp [insert_subset_iff, hx, g_mem]
15281528
suffices h : ∏ x ∈ s \ {x, g x hx}, f x = 1 by
15291529
rw [← prod_sdiff this, h, one_mul]
1530-
rcases eq_or_ne (g x hx) x
1531-
case inl hx' => simpa [hx'] using hg₃ x hx
1532-
case inr hx' => rw [prod_pair hx'.symm, hg₁]
1533-
suffices h₃ : ∀ a (ha : a ∈ s \ {x, g x hx}), g a (sdiff_subset ha) ∈ s \ {x, g x hx} by
1534-
exact ih (s \ {x, g x hx}) (ssubset_iff.2 ⟨x, by simp [insert_subset_iff, hx]⟩) _
1530+
cases eq_or_ne (g x hx) x with
1531+
| inl hx' => simpa [hx'] using hg₃ x hx
1532+
| inr hx' => rw [prod_pair hx'.symm, hg₁]
1533+
suffices h₃ : ∀ a (ha : a ∈ s \ {x, g x hx}), g a (sdiff_subset ha) ∈ s \ {x, g x hx} from
1534+
ih (s \ {x, g x hx}) (ssubset_iff.2 ⟨x, by simp [insert_subset_iff, hx]⟩) _
15351535
(by simp [hg₁]) (fun _ _ => hg₃ _ _) h₃ (fun _ _ => hg₄ _ _)
15361536
simp only [mem_sdiff, mem_insert, mem_singleton, not_or, g_mem, true_and]
15371537
rintro a ⟨ha₁, ha₂, ha₃⟩

Mathlib/Algebra/ContinuedFractions/Computation/CorrectnessTerminating.lean

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -99,29 +99,28 @@ theorem compExactValue_correctness_of_stream_eq_some :
9999
induction n with
100100
| zero =>
101101
intro ifp_zero stream_zero_eq
102-
-- Nat.zero
103-
have : IntFractPair.of v = ifp_zero := by
102+
obtain rfl : IntFractPair.of v = ifp_zero := by
104103
have : IntFractPair.stream v 0 = some (IntFractPair.of v) := rfl
105104
simpa only [this, Option.some.injEq] using stream_zero_eq
106-
cases this
107-
cases' Decidable.em (Int.fract v = 0) with fract_eq_zero fract_ne_zero
108-
-- Int.fract v = 0; we must then have `v = ⌊v⌋`
109-
· suffices v = ⌊v⌋ by
105+
cases eq_or_ne (Int.fract v) 0 with
106+
| inl fract_eq_zero =>
107+
-- Int.fract v = 0; we must then have `v = ⌊v⌋`
108+
suffices v = ⌊v⌋ by
110109
-- Porting note: was `simpa [contsAux, fract_eq_zero, compExactValue]`
111110
field_simp [nextConts, nextNum, nextDen, compExactValue]
112111
have : (IntFractPair.of v).fr = Int.fract v := rfl
113112
rwa [this, if_pos fract_eq_zero]
114113
calc
115114
v = Int.fract v + ⌊v⌋ := by rw [Int.fract_add_floor]
116115
_ = ⌊v⌋ := by simp [fract_eq_zero]
117-
-- Int.fract v ≠ 0; the claim then easily follows by unfolding a single computation step
118-
· field_simp [contsAux, nextConts, nextNum, nextDen, of_h_eq_floor, compExactValue]
116+
| inr fract_ne_zero =>
117+
-- Int.fract v ≠ 0; the claim then easily follows by unfolding a single computation step
118+
field_simp [contsAux, nextConts, nextNum, nextDen, of_h_eq_floor, compExactValue]
119119
-- Porting note: this and the if_neg rewrite are needed
120120
have : (IntFractPair.of v).fr = Int.fract v := rfl
121121
rw [this, if_neg fract_ne_zero, Int.floor_add_fract]
122122
| succ n IH =>
123123
intro ifp_succ_n succ_nth_stream_eq
124-
-- Nat.succ
125124
obtain ⟨ifp_n, nth_stream_eq, nth_fract_ne_zero, -⟩ :
126125
∃ ifp_n, IntFractPair.stream v n = some ifp_n ∧
127126
ifp_n.fr ≠ 0 ∧ IntFractPair.of ifp_n.fr⁻¹ = ifp_succ_n :=
@@ -130,9 +129,10 @@ theorem compExactValue_correctness_of_stream_eq_some :
130129
let conts := g.contsAux (n + 2)
131130
set pconts := g.contsAux (n + 1) with pconts_eq
132131
set ppconts := g.contsAux n with ppconts_eq
133-
cases' Decidable.em (ifp_succ_n.fr = 0) with ifp_succ_n_fr_eq_zero ifp_succ_n_fr_ne_zero
134-
-- ifp_succ_n.fr = 0
135-
· suffices v = conts.a / conts.b by simpa [compExactValue, ifp_succ_n_fr_eq_zero]
132+
cases eq_or_ne ifp_succ_n.fr 0 with
133+
| inl ifp_succ_n_fr_eq_zero =>
134+
-- ifp_succ_n.fr = 0
135+
suffices v = conts.a / conts.b by simpa [compExactValue, ifp_succ_n_fr_eq_zero]
136136
-- use the IH and the fact that ifp_n.fr⁻¹ = ⌊ifp_n.fr⁻¹⌋ to prove this case
137137
obtain ⟨ifp_n', nth_stream_eq', ifp_n_fract_inv_eq_floor⟩ :
138138
∃ ifp_n, IntFractPair.stream v n = some ifp_n ∧ ifp_n.fr⁻¹ = ⌊ifp_n.fr⁻¹⌋ :=
@@ -145,8 +145,9 @@ theorem compExactValue_correctness_of_stream_eq_some :
145145
suffices v = compExactValue ppconts pconts ifp_n.fr by
146146
simpa [conts, contsAux, s_nth_eq, compExactValue, nth_fract_ne_zero] using this
147147
exact IH nth_stream_eq
148-
-- ifp_succ_n.fr ≠ 0
149-
· -- use the IH to show that the following equality suffices
148+
| inr ifp_succ_n_fr_ne_zero =>
149+
-- ifp_succ_n.fr ≠ 0
150+
-- use the IH to show that the following equality suffices
150151
suffices
151152
compExactValue ppconts pconts ifp_n.fr = compExactValue pconts conts ifp_succ_n.fr by
152153
have : v = compExactValue ppconts pconts ifp_n.fr := IH nth_stream_eq
@@ -214,14 +215,14 @@ theorem of_correctness_of_nth_stream_eq_none (nth_stream_eq_none : IntFractPair.
214215
| succ n IH =>
215216
let g := of v
216217
change v = g.convs n
217-
have :
218+
obtain ⟨nth_stream_eq_none⟩ | ⟨ifp_n, nth_stream_eq, nth_stream_fr_eq_zero⟩ :
218219
IntFractPair.stream v n = none ∨ ∃ ifp, IntFractPair.stream v n = some ifp ∧ ifp.fr = 0 :=
219220
IntFractPair.succ_nth_stream_eq_none_iff.1 nth_stream_eq_none
220-
rcases this with (⟨nth_stream_eq_none⟩ | ⟨ifp_n, nth_stream_eq, nth_stream_fr_eq_zero⟩)
221-
· cases' n with n'
222-
· contradiction
223-
-- IntFractPair.stream v 0 ≠ none
224-
· have : g.TerminatedAt n' :=
221+
· cases n with
222+
| zero => contradiction
223+
| succ n' =>
224+
-- IntFractPair.stream v 0 ≠ none
225+
have : g.TerminatedAt n' :=
225226
of_terminatedAt_n_iff_succ_nth_intFractPair_stream_eq_none.2
226227
nth_stream_eq_none
227228
have : g.convs (n' + 1) = g.convs n' :=

Mathlib/AlgebraicTopology/DoldKan/HomotopyEquivalence.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def homotopyPInftyToId : Homotopy (PInfty : K[X] ⟶ _) (𝟙 _) where
6262
· simpa only [Homotopy.dNext_zero_chainComplex, Homotopy.prevD_chainComplex,
6363
PInfty_f, P_f_0_eq, zero_add] using (homotopyPToId X 2).comm 0
6464
· simp only [Homotopy.dNext_succ_chainComplex, Homotopy.prevD_chainComplex,
65-
HomologicalComplex.id_f, PInfty_f, ← P_is_eventually_constant (rfl.le : n + 1 n + 1)]
65+
HomologicalComplex.id_f, PInfty_f, ← P_is_eventually_constant (le_refl <| n + 1)]
6666
-- Porting note(lean4/2146): remaining proof was
6767
-- `simpa only [homotopyPToId_eventually_constant X (lt_add_one (Nat.succ n))]
6868
-- using (homotopyPToId X (n + 2)).comm (n + 1)`;

Mathlib/AlgebraicTopology/DoldKan/PInfty.lean

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ variable {C : Type*} [Category C] [Preadditive C] {X : SimplicialObject C}
3333

3434
theorem P_is_eventually_constant {q n : ℕ} (hqn : n ≤ q) :
3535
((P (q + 1)).f n : X _[n] ⟶ _) = (P q).f n := by
36-
rcases n with (_|n)
37-
· simp only [P_f_0_eq]
38-
· simp only [P_succ, add_right_eq_self, comp_add, HomologicalComplex.comp_f,
39-
HomologicalComplex.add_f_apply, comp_id]
36+
cases n with
37+
| zero => simp only [P_f_0_eq]
38+
| succ n =>
39+
simp only [P_succ, comp_add, comp_id, HomologicalComplex.add_f_apply, HomologicalComplex.comp_f,
40+
add_right_eq_self]
4041
exact (HigherFacesVanish.of_P q n).comp_Hσ_eq_zero (Nat.succ_le_iff.mp hqn)
4142

4243
theorem Q_is_eventually_constant {q n : ℕ} (hqn : n ≤ q) :

Mathlib/CategoryTheory/Category/Cat/Adjunction.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def connectedComponents : Cat.{v, u} ⥤ Type u where
5454
obj C := ConnectedComponents C
5555
map F := Functor.mapConnectedComponents F
5656
map_id _ := funext fun x ↦ (Quotient.exists_rep x).elim (fun _ h ↦ by subst h; rfl)
57-
map_comp _ _ := funext fun x ↦ (Quotient.exists_rep x).elim (fun _ h => by subst h;rfl)
57+
map_comp _ _ := funext fun x ↦ (Quotient.exists_rep x).elim (fun _ h => by subst h; rfl)
5858

5959
/-- `typeToCat : Type ⥤ Cat` is right adjoint to `connectedComponents : Cat ⥤ Type` -/
6060
def connectedComponentsTypeToCatAdj : connectedComponents ⊣ typeToCat where

Mathlib/Combinatorics/SimpleGraph/Diam.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,11 @@ lemma diam_top [Nontrivial α] : (⊤ : SimpleGraph α).diam = 1 := by
190190

191191
@[simp]
192192
lemma diam_eq_zero : G.diam = 0 ↔ G.ediam = ⊤ ∨ Subsingleton α := by
193-
rw [diam, ENat.toNat_eq_zero]
194-
aesop
193+
rw [diam, ENat.toNat_eq_zero, or_comm, ediam_eq_zero_iff_subsingleton]
195194

196195
@[simp]
197196
lemma diam_eq_one [Nontrivial α] : G.diam = 1 ↔ G = ⊤ := by
198-
rw [diam, ENat.toNat_eq_iff (by decide)]
199-
exact ediam_eq_one
197+
rw [diam, ENat.toNat_eq_iff one_ne_zero, Nat.cast_one, ediam_eq_one]
200198

201199
end diam
202200

Mathlib/Data/Finset/Lattice.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import Mathlib.Order.Nat
1818
# Lattice operations on finsets
1919
-/
2020

21-
-- TODO:
2221
assert_not_exists OrderedCommMonoid
2322
assert_not_exists MonoidWithZero
2423

Mathlib/Data/List/Sort.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ theorem perm_insertionSort : ∀ l : List α, insertionSort r l ~ l
256256
simpa [insertionSort] using (perm_orderedInsert _ _ _).trans ((perm_insertionSort l).cons b)
257257

258258
@[simp]
259-
theorem mem_insertionSort {l : List α} {x : α} : x ∈ l.insertionSort r ↔ x ∈ l :=
259+
theorem mem_insertionSort {l : List α} {x : α} : x ∈ l.insertionSort r ↔ x ∈ l :=
260260
(perm_insertionSort r l).mem_iff
261261

262262
@[simp]

0 commit comments

Comments
 (0)