Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 130e07d

Browse files
committed
chore(algebra/group/prod): prod.swap commutes with arithmetic (#12367)
This also adds some missing `div` lemmas using `to_additive`.
1 parent 5e36e12 commit 130e07d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/algebra/group/prod.lean

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ lemma snd_mul [has_mul M] [has_mul N] (p q : M × N) : (p * q).2 = p.2 * q.2 :=
4242
@[simp, to_additive]
4343
lemma mk_mul_mk [has_mul M] [has_mul N] (a₁ a₂ : M) (b₁ b₂ : N) :
4444
(a₁, b₁) * (a₂, b₂) = (a₁ * a₂, b₁ * b₂) := rfl
45+
@[simp, to_additive]
46+
lemma swap_mul [has_mul M] [has_mul N] (p q : M × N) : (p * q).swap = p.swap * q.swap := rfl
4547
@[to_additive]
4648
lemma mul_def [has_mul M] [has_mul N] (p q : M × N) : p * q = (p.1 * q.1, p.2 * q.2) := rfl
4749

@@ -57,6 +59,8 @@ lemma one_eq_mk [has_one M] [has_one N] : (1 : M × N) = (1, 1) := rfl
5759
@[simp, to_additive]
5860
lemma mk_eq_one [has_one M] [has_one N] {x : M} {y : N} : (x, y) = 1 ↔ x = 1 ∧ y = 1 :=
5961
mk.inj_iff
62+
@[simp, to_additive]
63+
lemma swap_one [has_one M] [has_one N] : (1 : M × N).swap = 1 := rfl
6064

6165
@[to_additive]
6266
lemma fst_mul_snd [mul_one_class M] [mul_one_class N] (p : M × N) :
@@ -72,14 +76,18 @@ lemma fst_inv [has_inv G] [has_inv H] (p : G × H) : (p⁻¹).1 = (p.1)⁻¹ :=
7276
lemma snd_inv [has_inv G] [has_inv H] (p : G × H) : (p⁻¹).2 = (p.2)⁻¹ := rfl
7377
@[simp, to_additive]
7478
lemma inv_mk [has_inv G] [has_inv H] (a : G) (b : H) : (a, b)⁻¹ = (a⁻¹, b⁻¹) := rfl
79+
@[simp, to_additive]
80+
lemma swap_inv [has_inv G] [has_inv H] (p : G × H) : (p⁻¹).swap = p.swap⁻¹ := rfl
7581

7682
@[to_additive]
7783
instance [has_div M] [has_div N] : has_div (M × N) := ⟨λ p q, ⟨p.1 / q.1, p.2 / q.2⟩⟩
7884

79-
@[simp] lemma fst_sub [add_group A] [add_group B] (a b : A × B) : (a - b).1 = a.1 - b.1 := rfl
80-
@[simp] lemma snd_sub [add_group A] [add_group B] (a b : A × B) : (a - b).2 = a.2 - b.2 := rfl
81-
@[simp] lemma mk_sub_mk [add_group A] [add_group B] (x₁ x₂ : A) (y₁ y₂ : B) :
82-
(x₁, y₁) - (x₂, y₂) = (x₁ - x₂, y₁ - y₂) := rfl
85+
@[simp, to_additive] lemma fst_div [group G] [group H] (a b : G × H) : (a / b).1 = a.1 / b.1 := rfl
86+
@[simp, to_additive] lemma snd_div [group G] [group H] (a b : G × H) : (a / b).2 = a.2 / b.2 := rfl
87+
@[simp, to_additive] lemma mk_div_mk [group G] [group H] (x₁ x₂ : G) (y₁ y₂ : H) :
88+
(x₁, y₁) / (x₂, y₂) = (x₁ / x₂, y₁ / y₂) := rfl
89+
@[simp, to_additive] lemma swap_div [group G] [group H] (a b : G × H) :
90+
(a / b).swap = a.swap / b.swap := rfl
8391

8492
instance [mul_zero_class M] [mul_zero_class N] : mul_zero_class (M × N) :=
8593
{ zero_mul := assume a, prod.rec_on a $ λa b, mk.inj_iff.mpr ⟨zero_mul _, zero_mul _⟩,

src/group_theory/group_action/prod.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ variables [has_scalar M α] [has_scalar M β] [has_scalar N α] [has_scalar N β
3232
@[simp, to_additive] theorem smul_snd : (a • x).2 = a • x.2 := rfl
3333
@[simp, to_additive] theorem smul_mk (a : M) (b : α) (c : β) : a • (b, c) = (a • b, a • c) := rfl
3434
@[to_additive] theorem smul_def (a : M) (x : α × β) : a • x = (a • x.1, a • x.2) := rfl
35+
@[simp, to_additive] theorem smul_swap : (a • x).swap = a • x.swap := rfl
3536

3637
instance [has_scalar M N] [is_scalar_tower M N α] [is_scalar_tower M N β] :
3738
is_scalar_tower M N (α × β) :=

0 commit comments

Comments
 (0)