Skip to content

Commit 0ee6552

Browse files
chore: tidy various files (#1412)
1 parent c2b7c75 commit 0ee6552

File tree

10 files changed

+171
-208
lines changed

10 files changed

+171
-208
lines changed

Mathlib/Algebra/Associated.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,9 @@ protected def mkMonoidHom : α →* Associates α :=
847847
#align associates.mk_monoid_hom Associates.mkMonoidHom
848848

849849
@[simp]
850-
theorem mk_monoidHom_apply (a : α) : Associates.mkMonoidHom a = Associates.mk a :=
850+
theorem mkMonoidHom_apply (a : α) : Associates.mkMonoidHom a = Associates.mk a :=
851851
rfl
852-
#align associates.mk_monoid_hom_apply Associates.mk_monoidHom_apply
852+
#align associates.mk_monoid_hom_apply Associates.mkMonoidHom_apply
853853

854854
theorem associated_map_mk {f : Associates α →* α} (hinv : Function.RightInverse f Associates.mk)
855855
(a : α) : a ~ᵤ f (Associates.mk a) :=

Mathlib/Algebra/GCDMonoid/Basic.lean

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ variable [CancelCommMonoidWithZero α] [NormalizationMonoid α]
212212

213213
attribute [local instance] Associated.setoid
214214

215-
/-- Maps an element of `associates` back to the normalized element of its associate class -/
215+
/-- Maps an element of `Associates` back to the normalized element of its associate class -/
216216
protected def out : Associates α → α :=
217217
(Quotient.lift (normalize : α → α)) fun a _ ⟨_, hu⟩ =>
218218
hu ▸ normalize_eq_normalize ⟨_, rfl⟩ (Units.mul_right_dvd.2 <| dvd_refl a)
@@ -395,7 +395,8 @@ theorem gcd_eq_zero_iff [GCDMonoid α] (a b : α) : gcd a b = 0 ↔ a = 0 ∧ b
395395
(fun h => by
396396
let ⟨ca, ha⟩ := gcd_dvd_left a b
397397
let ⟨cb, hb⟩ := gcd_dvd_right a b
398-
rw [h, zero_mul] at ha hb; exact ⟨ha, hb⟩)
398+
rw [h, zero_mul] at ha hb
399+
exact ⟨ha, hb⟩)
399400
fun ⟨ha, hb⟩ => by
400401
rw [ha, hb, ← zero_dvd_iff]
401402
apply dvd_gcd <;> rfl
@@ -821,13 +822,13 @@ theorem lcm_mul_left [NormalizedGCDMonoid α] (a b c : α) :
821822
fun ha : a ≠ 0 =>
822823
suffices lcm (a * b) (a * c) = normalize (a * lcm b c) by simpa
823824
have : a ∣ lcm (a * b) (a * c) := (dvd_mul_right _ _).trans (dvd_lcm_left _ _)
824-
let ⟨d, Eq⟩ := this
825+
let ⟨d, eq⟩ := this
825826
lcm_eq_normalize
826827
(lcm_dvd (mul_dvd_mul_left a (dvd_lcm_left _ _)) (mul_dvd_mul_left a (dvd_lcm_right _ _)))
827-
(Eq.symm ▸
828+
(eq.symm ▸
828829
(mul_dvd_mul_left a <|
829-
lcm_dvd ((mul_dvd_mul_iff_left ha).1 <| Eq ▸ dvd_lcm_left _ _)
830-
((mul_dvd_mul_iff_left ha).1 <| Eq ▸ dvd_lcm_right _ _)))
830+
lcm_dvd ((mul_dvd_mul_iff_left ha).1 <| eq ▸ dvd_lcm_left _ _)
831+
((mul_dvd_mul_iff_left ha).1 <| eq ▸ dvd_lcm_right _ _)))
831832
#align lcm_mul_left lcm_mul_left
832833

833834
@[simp]
@@ -905,16 +906,14 @@ section UniqueUnit
905906
variable [CancelCommMonoidWithZero α] [Unique αˣ]
906907

907908
-- see Note [lower instance priority]
908-
instance (priority := 100) normalizationMonoidOfUniqueUnits :
909-
NormalizationMonoid α where
909+
instance (priority := 100) normalizationMonoidOfUniqueUnits : NormalizationMonoid α where
910910
normUnit _ := 1
911911
normUnit_zero := rfl
912912
normUnit_mul _ _ := (mul_one 1).symm
913913
normUnit_coe_units _ := Subsingleton.elim _ _
914914
#align normalization_monoid_of_unique_units normalizationMonoidOfUniqueUnits
915915

916-
instance uniqueNormalizationMonoidOfUniqueUnits :
917-
Unique (NormalizationMonoid α) where
916+
instance uniqueNormalizationMonoidOfUniqueUnits : Unique (NormalizationMonoid α) where
918917
default := normalizationMonoidOfUniqueUnits
919918
uniq := fun ⟨u, _, _, _⟩ => by congr; simp
920919
#align unique_normalization_monoid_of_unique_units uniqueNormalizationMonoidOfUniqueUnits
@@ -939,8 +938,7 @@ instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
939938
simp only [hgcd, hlcm]⟩
940939
#align subsingleton_gcd_monoid_of_unique_units subsingleton_gcdMonoid_of_unique_units
941940

942-
instance subsingleton_normalizedGCDMonoid_of_unique_units :
943-
Subsingleton (NormalizedGCDMonoid α) :=
941+
instance subsingleton_normalizedGCDMonoid_of_unique_units : Subsingleton (NormalizedGCDMonoid α) :=
944942
by
945943
intro a b
946944
cases' a with a_norm a_gcd
@@ -967,8 +965,7 @@ theorem normalize_eq (x : α) : normalize x = x :=
967965

968966
/-- If a monoid's only unit is `1`, then it is isomorphic to its associates. -/
969967
@[simps]
970-
def associatesEquivOfUniqueUnits :
971-
Associates α ≃* α where
968+
def associatesEquivOfUniqueUnits : Associates α ≃* α where
972969
toFun := Associates.out
973970
invFun := Associates.mk
974971
left_inv := Associates.mk_out
@@ -984,7 +981,7 @@ variable [CommRing α] [IsDomain α] [NormalizedGCDMonoid α]
984981

985982
theorem gcd_eq_of_dvd_sub_right {a b c : α} (h : a ∣ b - c) : gcd a b = gcd a c := by
986983
apply dvd_antisymm_of_normalize_eq (normalize_gcd _ _) (normalize_gcd _ _) <;>
987-
rw [dvd_gcd_iff] <;>
984+
rw [dvd_gcd_iff] <;>
988985
refine' ⟨gcd_dvd_left _ _, _⟩
989986
· rcases h with ⟨d, hd⟩
990987
rcases gcd_dvd_right a b with ⟨e, he⟩
@@ -1023,7 +1020,7 @@ def normalizationMonoidOfMonoidHomRightInverse [DecidableEq α] (f : Associates
10231020
if a = 0 then 1
10241021
else Classical.choose (Associates.mk_eq_mk_iff_associated.1 (hinv (Associates.mk a)).symm)
10251022
normUnit_zero := if_pos rfl
1026-
normUnit_mul := fun {a b} ha hb => by
1023+
normUnit_mul {a b} ha hb := by
10271024
simp_rw [if_neg (mul_ne_zero ha hb), if_neg ha, if_neg hb, Units.ext_iff, Units.val_mul]
10281025
suffices
10291026
a * b * ↑(Classical.choose (associated_map_mk hinv (a * b))) =
@@ -1363,9 +1360,7 @@ variable (G₀ : Type _) [CommGroupWithZero G₀] [DecidableEq G₀]
13631360

13641361
-- Porting note: very slow; improve performance?
13651362
-- see Note [lower instance priority]
1366-
instance (priority := 100) :
1367-
NormalizedGCDMonoid
1368-
G₀ where
1363+
instance (priority := 100) : NormalizedGCDMonoid G₀ where
13691364
normUnit x := if h : x = 0 then 1 else (Units.mk0 x h)⁻¹
13701365
normUnit_zero := dif_pos rfl
13711366
normUnit_mul := fun {x y} x0 y0 => Units.eq_iff.1 (by

Mathlib/Algebra/Order/Monoid/WithTop.lean

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,20 @@ theorem coe_add : ((x + y : α) : WithTop α) = x + y :=
9292
rfl
9393
#align with_top.coe_add WithTop.coe_add
9494

95-
-- Porting note: Linter says these are syntactic tautologies.
96-
-- Porting note: `bit0` and `bit1` are deprecated. Section can be removed without replacement.
97-
-- section deprecated
98-
-- set_option linter.deprecated false
99-
100-
-- --@[norm_cast]
101-
-- @[deprecated]
102-
-- theorem coe_bit0 : ((bit0 x : α) : WithTop α) = bit0 x :=
103-
-- rfl
104-
-- #align with_top.coe_bit0 WithTop.coe_bit0
95+
section deprecated
96+
set_option linter.deprecated false
10597

106-
-- -- @[norm_cast]
107-
-- @[deprecated]
108-
-- theorem coe_bit1 [One α] {a : α} : ((bit1 a : α) : WithTop α) = bit1 a :=
109-
-- rfl
110-
-- #align with_top.coe_bit1 WithTop.coe_bit1
98+
@[norm_cast, deprecated]
99+
theorem coe_bit0 : ((bit0 x : α) : WithTop α) = (bit0 x : WithTop α) :=
100+
rfl
101+
#align with_top.coe_bit0 WithTop.coe_bit0
102+
103+
@[norm_cast, deprecated]
104+
theorem coe_bit1 [One α] {a : α} : ((bit1 a : α) : WithTop α) = (bit1 a : WithTop α) :=
105+
rfl
106+
#align with_top.coe_bit1 WithTop.coe_bit1
111107

112-
-- end deprecated
108+
end deprecated
113109

114110
@[simp]
115111
theorem top_add (a : WithTop α) : ⊤ + a = ⊤ :=
@@ -542,22 +538,22 @@ theorem coe_add (a b : α) : ((a + b : α) : WithBot α) = a + b :=
542538
rfl
543539
#align with_bot.coe_add WithBot.coe_add
544540

545-
-- Porting note: Linter says these are syntactical tautologies now.
546-
-- Porting note: `bit0` and `bit1` are deprecated. Section can be removed without replacement.
547-
-- section deprecated
548-
-- set_option linter.deprecated false
541+
section deprecated
542+
set_option linter.deprecated false
549543

550-
-- @[deprecated]
551-
-- theorem coe_bit0 : ((bit0 x : α) : WithBot α) = bit0 x :=
552-
-- rfl
553-
-- #align with_bot.coe_bit0 WithBot.coe_bit0
544+
-- Porting note: added norm_cast
545+
@[norm_cast, deprecated]
546+
theorem coe_bit0 : ((bit0 x : α) : WithBot α) = (bit0 x : WithBot α) :=
547+
rfl
548+
#align with_bot.coe_bit0 WithBot.coe_bit0
554549

555-
-- @[deprecated]
556-
-- theorem coe_bit1 [One α] {a : α} : ((bit1 a : α) : WithBot α) = bit1 a :=
557-
-- rfl
558-
-- #align with_bot.coe_bit1 WithBot.coe_bit1
550+
-- Porting note: added norm_cast
551+
@[norm_cast, deprecated]
552+
theorem coe_bit1 [One α] {a : α} : ((bit1 a : α) : WithBot α) = (bit1 a : WithBot α) :=
553+
rfl
554+
#align with_bot.coe_bit1 WithBot.coe_bit1
559555

560-
-- end deprecated
556+
end deprecated
561557

562558
@[simp]
563559
theorem bot_add (a : WithBot α) : ⊥ + a = ⊥ :=

Mathlib/Algebra/Tropical/Basic.lean

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ well as the expected implementations of tropical addition and tropical multiplic
2626
* `Tropical R`: The type synonym of the tropical interpretation of `R`.
2727
If `[LinearOrder R]`, then addition on `R` is via `min`.
2828
* `Semiring (Tropical R)`: A `LinearOrderedAddCommMonoidWithTop R`
29-
induces a `Semiring (Tropical R)`. If one solely has `[LinearOrderedAddComm<onoid R]`,
29+
induces a `Semiring (Tropical R)`. If one solely has `[LinearOrderedAddCommMonoid R]`,
3030
then the "tropicalization of `R`" would be `Tropical (WithTop R)`.
3131
3232
## Implementation notes
@@ -61,7 +61,7 @@ variable {R}
6161

6262
namespace Tropical
6363

64-
/-- Reinterpret `x : R` as an element of `tropical R`.
64+
/-- Reinterpret `x : R` as an element of `Tropical R`.
6565
See `Tropical.tropEquiv` for the equivalence.
6666
-/
6767
--@[pp_nodot] Porting note: not implemented in Lean4
@@ -105,13 +105,13 @@ theorem untrop_trop (x : R) : untrop (trop x) = x :=
105105
--Porting note: New attribute seems to fix things
106106
attribute [irreducible] Tropical
107107

108-
theorem left_inverse_trop : Function.LeftInverse (trop : R → Tropical R) untrop :=
108+
theorem leftInverse_trop : Function.LeftInverse (trop : R → Tropical R) untrop :=
109109
trop_untrop
110-
#align tropical.left_inverse_trop Tropical.left_inverse_trop
110+
#align tropical.left_inverse_trop Tropical.leftInverse_trop
111111

112-
theorem right_inverse_trop : Function.RightInverse (trop : R → Tropical R) untrop :=
112+
theorem rightInverse_trop : Function.RightInverse (trop : R → Tropical R) untrop :=
113113
untrop_trop
114-
#align tropical.right_inverse_trop Tropical.right_inverse_trop
114+
#align tropical.right_inverse_trop Tropical.rightInverse_trop
115115

116116
/-- Reinterpret `x : R` as an element of `Tropical R`.
117117
See `Tropical.tropOrderIso` for the order-preserving equivalence. -/
@@ -177,10 +177,10 @@ theorem untrop_le_iff [LE R] {x y : Tropical R} : untrop x ≤ untrop y ↔ x
177177
Iff.rfl
178178
#align tropical.untrop_le_iff Tropical.untrop_le_iff
179179

180-
instance decidableLe [LE R] [DecidableRel ((· ≤ ·) : R → R → Prop)] :
180+
instance decidableLE [LE R] [DecidableRel ((· ≤ ·) : R → R → Prop)] :
181181
DecidableRel ((· ≤ ·) : Tropical R → Tropical R → Prop) := fun x y =>
182182
‹DecidableRel (· ≤ ·)› (untrop x) (untrop y)
183-
#align tropical.decidable_le Tropical.decidableLe
183+
#align tropical.decidable_le Tropical.decidableLE
184184

185185
instance [LT R] : LT (Tropical R) where lt x y := untrop x < untrop y
186186

@@ -189,10 +189,10 @@ theorem untrop_lt_iff [LT R] {x y : Tropical R} : untrop x < untrop y ↔ x < y
189189
Iff.rfl
190190
#align tropical.untrop_lt_iff Tropical.untrop_lt_iff
191191

192-
instance decidableLt [LT R] [DecidableRel ((· < ·) : R → R → Prop)] :
192+
instance decidableLT [LT R] [DecidableRel ((· < ·) : R → R → Prop)] :
193193
DecidableRel ((· < ·) : Tropical R → Tropical R → Prop) := fun x y =>
194194
‹DecidableRel (· < ·)› (untrop x) (untrop y)
195-
#align tropical.decidable_lt Tropical.decidableLt
195+
#align tropical.decidable_lt Tropical.decidableLT
196196

197197
instance [Preorder R] : Preorder (Tropical R) :=
198198
{ instLETropical, instLTTropical with
@@ -206,14 +206,14 @@ def tropOrderIso [Preorder R] : R ≃o Tropical R :=
206206
#align tropical.trop_order_iso Tropical.tropOrderIso
207207

208208
@[simp]
209-
theorem trop_order_iso_coe_fn [Preorder R] : (tropOrderIso : R → Tropical R) = trop :=
209+
theorem tropOrderIso_coe_fn [Preorder R] : (tropOrderIso : R → Tropical R) = trop :=
210210
rfl
211-
#align tropical.trop_order_iso_coe_fn Tropical.trop_order_iso_coe_fn
211+
#align tropical.trop_order_iso_coe_fn Tropical.tropOrderIso_coe_fn
212212

213213
@[simp]
214-
theorem trop_order_iso_symm_coe_fn [Preorder R] : (tropOrderIso.symm : Tropical R → R) = untrop :=
214+
theorem tropOrderIso_symm_coe_fn [Preorder R] : (tropOrderIso.symm : Tropical R → R) = untrop :=
215215
rfl
216-
#align tropical.trop_order_iso_symm_coe_fn Tropical.trop_order_iso_symm_coe_fn
216+
#align tropical.trop_order_iso_symm_coe_fn Tropical.tropOrderIso_symm_coe_fn
217217

218218
theorem trop_monotone [Preorder R] : Monotone (trop : R → Tropical R) := fun _ _ => id
219219
#align tropical.trop_monotone Tropical.trop_monotone
@@ -264,8 +264,7 @@ variable [LinearOrder R]
264264
instance : Add (Tropical R) :=
265265
fun x y => trop (min (untrop x) (untrop y))⟩
266266

267-
instance : AddCommSemigroup (Tropical
268-
R) where
267+
instance : AddCommSemigroup (Tropical R) where
269268
add := (· + ·)
270269
add_assoc _ _ _ := untrop_injective (min_assoc _ _ _)
271270
add_comm _ _ := untrop_injective (min_comm _ _)
@@ -292,7 +291,7 @@ theorem trop_add_def (x y : Tropical R) : x + y = trop (min (untrop x) (untrop y
292291
instance : LinearOrder (Tropical R) :=
293292
{ instPartialOrderTropical with
294293
le_total := fun a b => le_total (untrop a) (untrop b)
295-
decidable_le := Tropical.decidableLe
294+
decidable_le := Tropical.decidableLE
296295
max := fun a b => trop (max (untrop a) (untrop b))
297296
max_def := fun a b => untrop_injective (by simp [max_def]; split_ifs <;> simp)
298297
min := (· + ·)
@@ -436,8 +435,7 @@ theorem untrop_div [Sub R] (x y : Tropical R) : untrop (x / y) = untrop x - untr
436435
rfl
437436
#align tropical.untrop_div Tropical.untrop_div
438437

439-
instance [AddSemigroup R] :
440-
Semigroup (Tropical R) where
438+
instance [AddSemigroup R] : Semigroup (Tropical R) where
441439
mul := (· * ·)
442440
mul_assoc _ _ _ := untrop_injective (add_assoc _ _ _)
443441

@@ -457,8 +455,7 @@ theorem trop_smul {α : Type _} [SMul α R] (x : R) (n : α) : trop (n • x) =
457455
rfl
458456
#align tropical.trop_smul Tropical.trop_smul
459457

460-
instance [AddZeroClass R] : MulOneClass
461-
(Tropical R) where
458+
instance [AddZeroClass R] : MulOneClass (Tropical R) where
462459
one := 1
463460
mul := (· * ·)
464461
one_mul _ := untrop_injective <| zero_add _

Mathlib/Data/Bool/AllAny.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Mathlib.Data.List.Basic
1313
/-!
1414
# Boolean quantifiers
1515
16-
This proves a few properties about `List.all` and `List.any`, which are the `bool` universal and
16+
This proves a few properties about `List.all` and `List.any`, which are the `Bool` universal and
1717
existential quantifiers. Their definitions are in core Lean.
1818
-/
1919

Mathlib/Data/List/Infix.lean

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This file proves properties about
2121
* `List.tails`: The list of prefixes of a list.
2222
* `insert` on lists
2323
24-
All those (except `insert`) are defined in `Mathlib>Data.List.Defs`.
24+
All those (except `insert`) are defined in `Mathlib.Data.List.Defs`.
2525
2626
## Notation
2727
@@ -418,9 +418,6 @@ instance decidableSuffix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (
418418
suffix_cons_iff.symm
419419
termination_by decidableSuffix l₁ l₂ => (l₁, l₂)
420420

421-
instance foo {a b : Prop }[Decidable a] [Decidable b] : Decidable (a ∨ b) :=
422-
instDecidableOr
423-
424421
#align list.decidable_suffix List.decidableSuffix
425422

426423
instance decidableInfix [DecidableEq α] : ∀ l₁ l₂ : List α, Decidable (l₁ <:+: l₂)
@@ -513,20 +510,17 @@ theorem isInfix.filter (p : α → Prop) [DecidablePred p] ⦃l₁ l₂ : List
513510
exact infix_append _ _ _
514511
#align list.is_infix.filter List.isInfix.filter
515512

516-
instance : IsPartialOrder (List α) (· <+: ·)
517-
where
513+
instance : IsPartialOrder (List α) (· <+: ·) where
518514
refl := prefix_refl
519515
trans _ _ _ := isPrefix.trans
520516
antisymm _ _ h₁ h₂ := eq_of_prefix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le
521517

522-
instance : IsPartialOrder (List α) (· <:+ ·)
523-
where
518+
instance : IsPartialOrder (List α) (· <:+ ·) where
524519
refl := suffix_refl
525520
trans _ _ _ := isSuffix.trans
526521
antisymm _ _ h₁ h₂ := eq_of_suffix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le
527522

528-
instance : IsPartialOrder (List α) (· <:+: ·)
529-
where
523+
instance : IsPartialOrder (List α) (· <:+: ·) where
530524
refl := infix_refl
531525
trans _ _ _ := isInfix.trans
532526
antisymm _ _ h₁ h₂ := eq_of_infix_of_length_eq h₁ <| h₁.length_le.antisymm h₂.length_le

0 commit comments

Comments
 (0)