Skip to content

Commit abbba04

Browse files
committed
refactor(*): Protect Function.Commute (#6456)
This PR protects `Function.Commute`, so that it no longer clashes with `Commute` in the root namespace, as suggested by @j-loreaux in #6290.
1 parent 34ce2e5 commit abbba04

File tree

13 files changed

+26
-16
lines changed

13 files changed

+26
-16
lines changed

Mathlib/Algebra/Hom/Iterate.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ theorem SemiconjBy.function_semiconj_mul_left (h : SemiconjBy a b c) :
239239
#align add_semiconj_by.function_semiconj_add_left AddSemiconjBy.function_semiconj_add_left
240240

241241
@[to_additive]
242-
theorem Commute.function_commute_mul_left (h : _root_.Commute a b) :
242+
theorem Commute.function_commute_mul_left (h : Commute a b) :
243243
Function.Commute (a * ·) (b * ·) :=
244244
SemiconjBy.function_semiconj_mul_left h
245245
#align commute.function_commute_mul_left Commute.function_commute_mul_left
@@ -252,7 +252,7 @@ theorem SemiconjBy.function_semiconj_mul_right_swap (h : SemiconjBy a b c) :
252252
#align add_semiconj_by.function_semiconj_add_right_swap AddSemiconjBy.function_semiconj_add_right_swap
253253

254254
@[to_additive]
255-
theorem Commute.function_commute_mul_right (h : _root_.Commute a b) :
255+
theorem Commute.function_commute_mul_right (h : Commute a b) :
256256
Function.Commute (· * a) (· * b) :=
257257
SemiconjBy.function_semiconj_mul_right_swap h
258258
#align commute.function_commute_mul_right Commute.function_commute_mul_right

Mathlib/Data/Fintype/Card.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ instance Prod.infinite_of_left [Infinite α] [Nonempty β] : Infinite (α × β)
10621062
#align prod.infinite_of_left Prod.infinite_of_left
10631063

10641064
instance instInfiniteProdSubtypeCommute [Mul α] [Infinite α] :
1065-
Infinite { p : α × α // _root_.Commute p.1 p.2 } :=
1065+
Infinite { p : α × α // Commute p.1 p.2 } :=
10661066
Infinite.of_injective (fun a => ⟨⟨a, a⟩, rfl⟩) (by intro; simp)
10671067

10681068
namespace Infinite

Mathlib/Dynamics/FixedPoints/Basic.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ variable {α : Type u} {β : Type v} {f fa g : α → α} {x y : α} {fb : β
3333

3434
namespace Function
3535

36+
open Function (Commute)
37+
3638
/-- A point `x` is a fixed point of `f : α → α` if `f x = x`. -/
3739
def IsFixedPt (f : α → α) (x : α) :=
3840
f x = x

Mathlib/Dynamics/PeriodicPts.lean

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ open Set
4646

4747
namespace Function
4848

49+
open Function (Commute)
50+
4951
variable {α : Type*} {β : Type*} {f fa : α → α} {fb : β → β} {x y : α} {m n : ℕ}
5052

5153
/-- A point `x` is a periodic point of `f : α → α` of period `n` if `f^[n] x = x`.
@@ -421,18 +423,18 @@ theorem minimalPeriod_eq_prime_pow {p k : ℕ} [hp : Fact p.Prime] (hk : ¬IsPer
421423
rwa [← isPeriodicPt_iff_minimalPeriod_dvd]
422424
#align function.minimal_period_eq_prime_pow Function.minimalPeriod_eq_prime_pow
423425

424-
theorem Commute.minimalPeriod_of_comp_dvd_lcm {g : α → α} (h : Function.Commute f g) :
426+
theorem Commute.minimalPeriod_of_comp_dvd_lcm {g : α → α} (h : Commute f g) :
425427
minimalPeriod (f ∘ g) x ∣ Nat.lcm (minimalPeriod f x) (minimalPeriod g x) := by
426428
rw [← isPeriodicPt_iff_minimalPeriod_dvd]
427429
exact (isPeriodicPt_minimalPeriod f x).comp_lcm h (isPeriodicPt_minimalPeriod g x)
428430
#align function.commute.minimal_period_of_comp_dvd_lcm Function.Commute.minimalPeriod_of_comp_dvd_lcm
429431

430-
theorem Commute.minimalPeriod_of_comp_dvd_mul {g : α → α} (h : Function.Commute f g) :
432+
theorem Commute.minimalPeriod_of_comp_dvd_mul {g : α → α} (h : Commute f g) :
431433
minimalPeriod (f ∘ g) x ∣ minimalPeriod f x * minimalPeriod g x :=
432434
dvd_trans h.minimalPeriod_of_comp_dvd_lcm (lcm_dvd_mul _ _)
433435
#align function.commute.minimal_period_of_comp_dvd_mul Function.Commute.minimalPeriod_of_comp_dvd_mul
434436

435-
theorem Commute.minimalPeriod_of_comp_eq_mul_of_coprime {g : α → α} (h : Function.Commute f g)
437+
theorem Commute.minimalPeriod_of_comp_eq_mul_of_coprime {g : α → α} (h : Commute f g)
436438
(hco : coprime (minimalPeriod f x) (minimalPeriod g x)) :
437439
minimalPeriod (f ∘ g) x = minimalPeriod f x * minimalPeriod g x := by
438440
apply h.minimalPeriod_of_comp_dvd_mul.antisymm

Mathlib/GroupTheory/GroupAction/Quotient.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,14 +418,14 @@ section conjClasses
418418
open Fintype
419419

420420
theorem card_comm_eq_card_conjClasses_mul_card (G : Type*) [Group G] :
421-
Nat.card { p : G × G // _root_.Commute p.1 p.2 } = Nat.card (ConjClasses G) * Nat.card G := by
421+
Nat.card { p : G × G // Commute p.1 p.2 } = Nat.card (ConjClasses G) * Nat.card G := by
422422
classical
423423
rcases fintypeOrInfinite G; swap
424424
· rw [mul_comm, Nat.card_eq_zero_of_infinite, Nat.card_eq_zero_of_infinite, zero_mul]
425425
simp only [Nat.card_eq_fintype_card]
426426
-- Porting note: Changed `calc` proof into a `rw` proof.
427-
rw [card_congr (Equiv.subtypeProdEquivSigmaSubtype _root_.Commute), card_sigma,
428-
sum_equiv ConjAct.toConjAct.toEquiv (fun a ↦ card { b // _root_.Commute a b })
427+
rw [card_congr (Equiv.subtypeProdEquivSigmaSubtype Commute), card_sigma,
428+
sum_equiv ConjAct.toConjAct.toEquiv (fun a ↦ card { b // Commute a b })
429429
(fun g ↦ card (MulAction.fixedBy (ConjAct G) G g))
430430
fun g ↦ card_congr' <| congr_arg _ <| funext fun h ↦ mul_inv_eq_iff_eq_mul.symm.to_eq,
431431
MulAction.sum_card_fixedBy_eq_card_orbits_mul_card_group]

Mathlib/GroupTheory/OrderOfElement.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ theorem orderOf_pow_coprime (h : (orderOf y).coprime m) : orderOf (y ^ m) = orde
375375

376376
namespace Commute
377377

378-
variable {x} (h : _root_.Commute x y)
378+
variable {x} (h : Commute x y)
379379

380380
@[to_additive]
381381
theorem orderOf_mul_dvd_lcm : orderOf (x * y) ∣ Nat.lcm (orderOf x) (orderOf y) := by

Mathlib/GroupTheory/Perm/Cycle/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ theorem pow_apply_eq_pow_mod_orderOf_cycleOf_apply (f : Perm α) (n : ℕ) (x :
11061106
rw [← cycleOf_pow_apply_self f, ← cycleOf_pow_apply_self f, pow_eq_mod_orderOf]
11071107
#align equiv.perm.pow_apply_eq_pow_mod_order_of_cycle_of_apply Equiv.Perm.pow_apply_eq_pow_mod_orderOf_cycleOf_apply
11081108

1109-
theorem cycleOf_mul_of_apply_right_eq_self (h : _root_.Commute f g) (x : α) (hx : g x = x) :
1109+
theorem cycleOf_mul_of_apply_right_eq_self (h : Commute f g) (x : α) (hx : g x = x) :
11101110
(f * g).cycleOf x = f.cycleOf x := by
11111111
ext y
11121112
by_cases hxy : (f * g).SameCycle x y

Mathlib/GroupTheory/Subgroup/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3622,7 +3622,7 @@ theorem SubgroupNormal.mem_comm {H K : Subgroup G} (hK : H ≤ K) [hN : (H.subgr
36223622
@[to_additive "Elements of disjoint, normal subgroups commute."]
36233623
theorem commute_of_normal_of_disjoint (H₁ H₂ : Subgroup G) (hH₁ : H₁.Normal) (hH₂ : H₂.Normal)
36243624
-- Porting note: Goal was `Commute x y`. Removed ambiguity.
3625-
(hdis : Disjoint H₁ H₂) (x y : G) (hx : x ∈ H₁) (hy : y ∈ H₂) : _root_.Commute x y := by
3625+
(hdis : Disjoint H₁ H₂) (x y : G) (hx : x ∈ H₁) (hy : y ∈ H₂) : Commute x y := by
36263626
suffices x * y * x⁻¹ * y⁻¹ = 1 by
36273627
show x * y = y * x
36283628
· rw [mul_assoc, mul_eq_one_iff_eq_inv] at this

Mathlib/GroupTheory/Sylow.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ noncomputable def directProductOfNormal [Fintype G]
785785
set ps := (Fintype.card G).factorization.support
786786
-- “The” Sylow subgroup for p
787787
let P : ∀ p, Sylow p G := default
788-
have hcomm : Pairwise fun p₁ p₂ : ps => ∀ x y : G, x ∈ P p₁ → y ∈ P p₂ → _root_.Commute x y := by
788+
have hcomm : Pairwise fun p₁ p₂ : ps => ∀ x y : G, x ∈ P p₁ → y ∈ P p₂ → Commute x y := by
789789
rintro ⟨p₁, hp₁⟩ ⟨p₂, hp₂⟩ hne
790790
haveI hp₁' := Fact.mk (Nat.prime_of_mem_factorization hp₁)
791791
haveI hp₂' := Fact.mk (Nat.prime_of_mem_factorization hp₂)

Mathlib/Logic/Function/Conjugate.lean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ Two maps `f g : α → α` commute if `f (g x) = g (f x)` for all `x : α`.
8181
Given `h : Function.commute f g` and `a : α`, we have `h a : f (g a) = g (f a)` and
8282
`h.comp_eq : f ∘ g = g ∘ f`.
8383
-/
84-
def Commute (f g : α → α) : Prop :=
84+
protected def Commute (f g : α → α) : Prop :=
8585
Semiconj f g g
8686
#align function.commute Function.Commute
8787

88+
open Function (Commute)
89+
8890
/-- Reinterpret `Function.Semiconj f g g` as `Function.Commute f g`. These two predicates are
8991
definitionally equal but have different dot-notation lemmas. -/
9092
theorem Semiconj.commute {f g : α → α} (h : Semiconj f g g) : Commute f g := h

0 commit comments

Comments
 (0)