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

Commit d8d0c59

Browse files
committed
chore(algebra/opposites): split group actions and division_ring into their own files (#10383)
This splits out `group_theory.group_action.opposite` and `algebra.field.opposite` from `algebra.opposites`. The motivation is to make opposite actions available slightly earlier in the import graph. We probably want to split out `ring` at some point too, but that's likely a more annoying change so I've left it for future work. These lemmas are just moved, and some `_root_` prefixes eliminated by removing the surrounding `namespace`.
1 parent 2aea996 commit d8d0c59

File tree

18 files changed

+156
-98
lines changed

18 files changed

+156
-98
lines changed

src/algebra/char_p/invertible.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Anne Baanen
55
-/
66
import algebra.invertible
7-
import algebra.field
7+
import algebra.field.basic
88
import algebra.char_p.basic
99

1010
/-!

src/algebra/continued_fractions/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kevin Kappelmann
55
-/
66
import data.seq.seq
7-
import algebra.field
7+
import algebra.field.basic
88
/-!
99
# Basic Definitions/Theorems for Continued Fractions
1010

src/algebra/euclidean_domain.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Louis Carlin, Mario Carneiro
55
-/
66

77
import data.int.basic
8-
import algebra.field
8+
import algebra.field.basic
99

1010
/-!
1111
# Euclidean domains
File renamed without changes.

src/algebra/field/opposite.lean

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/-
2+
Copyright (c) 2018 Kenny Lau. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Kenny Lau
5+
-/
6+
import algebra.field.basic
7+
import algebra.opposites
8+
9+
/-!
10+
# Field structure on the multiplicative opposite
11+
-/
12+
13+
variables (α : Type*)
14+
15+
namespace mul_opposite
16+
17+
instance [division_ring α] : division_ring αᵐᵒᵖ :=
18+
{ .. mul_opposite.group_with_zero α, .. mul_opposite.ring α }
19+
20+
instance [field α] : field αᵐᵒᵖ :=
21+
{ .. mul_opposite.division_ring α, .. mul_opposite.comm_ring α }
22+
23+
end mul_opposite

src/algebra/module/opposites.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Copyright (c) 2020 Eric Wieser. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Eric Wieser
55
-/
6-
import algebra.opposites
6+
import group_theory.group_action.opposite
77
import data.equiv.module
88

99
/-!
1010
# Module operations on `Mᵐᵒᵖ`
1111
12-
This file contains definitions that could not be placed into `algebra.opposites` due to import
13-
cycles.
12+
This file contains definitions that build on top of the group action definitions in
13+
`group_theory.group_action.opposite`.
1414
-/
1515

1616
namespace mul_opposite

src/algebra/opposites.lean

Lines changed: 2 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ Copyright (c) 2018 Kenny Lau. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Kenny Lau
55
-/
6-
import algebra.field
76
import algebra.group.commute
8-
import group_theory.group_action.defs
7+
import algebra.ring.basic
98
import data.equiv.mul_add
109

1110
/-!
1211
# Multiplicative opposite and algebraic operations on it
1312
14-
In this file we define `mul_oppposite α = αᵐᵒᵖ` to be the multiplicative opposite of `α`. It
13+
In this file we define `mul_opposite α = αᵐᵒᵖ` to be the multiplicative opposite of `α`. It
1514
inherits all additive algebraic structures on `α`, and reverses the order of multipliers in
1615
multiplicative structures, i.e., `op (x * y) = op x * op y`, where `mul_opposite.op` is the
1716
canonical map from `α` to `αᵐᵒᵖ`.
@@ -294,89 +293,6 @@ instance [group_with_zero α] : group_with_zero αᵐᵒᵖ :=
294293
.. mul_opposite.monoid_with_zero α, .. mul_opposite.div_inv_monoid α,
295294
.. mul_opposite.nontrivial α }
296295

297-
instance [division_ring α] : division_ring αᵐᵒᵖ :=
298-
{ .. mul_opposite.group_with_zero α, .. mul_opposite.ring α }
299-
300-
instance [field α] : field αᵐᵒᵖ :=
301-
{ .. mul_opposite.division_ring α, .. mul_opposite.comm_ring α }
302-
303-
instance (R : Type*) [monoid R] [mul_action R α] : mul_action R αᵐᵒᵖ :=
304-
{ one_smul := λ x, unop_injective $ one_smul R (unop x),
305-
mul_smul := λ r₁ r₂ x, unop_injective $ mul_smul r₁ r₂ (unop x),
306-
.. mul_opposite.has_scalar α R }
307-
308-
instance (R : Type*) [monoid R] [add_monoid α] [distrib_mul_action R α] :
309-
distrib_mul_action R αᵐᵒᵖ :=
310-
{ smul_add := λ r x₁ x₂, unop_injective $ smul_add r (unop x₁) (unop x₂),
311-
smul_zero := λ r, unop_injective $ smul_zero r,
312-
.. mul_opposite.mul_action α R }
313-
314-
instance (R : Type*) [monoid R] [monoid α] [mul_distrib_mul_action R α] :
315-
mul_distrib_mul_action R αᵐᵒᵖ :=
316-
{ smul_mul := λ r x₁ x₂, unop_injective $ smul_mul' r (unop x₂) (unop x₁),
317-
smul_one := λ r, unop_injective $ smul_one r,
318-
.. mul_opposite.mul_action α R }
319-
320-
instance {M N} [has_scalar M N] [has_scalar M α] [has_scalar N α] [is_scalar_tower M N α] :
321-
is_scalar_tower M N αᵐᵒᵖ :=
322-
⟨λ x y z, unop_injective $ smul_assoc _ _ _⟩
323-
324-
instance {M N} [has_scalar M α] [has_scalar N α] [smul_comm_class M N α] :
325-
smul_comm_class M N αᵐᵒᵖ :=
326-
⟨λ x y z, unop_injective $ smul_comm _ _ _⟩
327-
328-
/-- Like `has_mul.to_has_scalar`, but multiplies on the right.
329-
330-
See also `monoid.to_opposite_mul_action` and `monoid_with_zero.to_opposite_mul_action`. -/
331-
instance _root_.has_mul.to_has_opposite_scalar [has_mul α] : has_scalar αᵐᵒᵖ α :=
332-
{ smul := λ c x, x * c.unop }
333-
334-
@[simp] lemma op_smul_eq_mul [has_mul α] {a a' : α} : op a • a' = a' * a := rfl
335-
336-
-- TODO: add an additive version once we have additive opposites
337-
/-- The right regular action of a group on itself is transitive. -/
338-
instance _root_.mul_action.opposite_regular.is_pretransitive {G : Type*} [group G] :
339-
mul_action.is_pretransitive Gᵐᵒᵖ G :=
340-
⟨λ x y, ⟨op (x⁻¹ * y), mul_inv_cancel_left _ _⟩⟩
341-
342-
instance _root_.semigroup.opposite_smul_comm_class [semigroup α] :
343-
smul_comm_class αᵐᵒᵖ α α :=
344-
{ smul_comm := λ x y z, (mul_assoc _ _ _) }
345-
346-
instance _root_.semigroup.opposite_smul_comm_class' [semigroup α] :
347-
smul_comm_class α αᵐᵒᵖ α :=
348-
{ smul_comm := λ x y z, (mul_assoc _ _ _).symm }
349-
350-
/-- Like `monoid.to_mul_action`, but multiplies on the right. -/
351-
instance _root_.monoid.to_opposite_mul_action [monoid α] : mul_action αᵐᵒᵖ α :=
352-
{ smul := (•),
353-
one_smul := mul_one,
354-
mul_smul := λ x y r, (mul_assoc _ _ _).symm }
355-
356-
instance _root_.is_scalar_tower.opposite_mid {M N} [monoid N] [has_scalar M N]
357-
[smul_comm_class M N N] :
358-
is_scalar_tower M Nᵐᵒᵖ N :=
359-
⟨λ x y z, mul_smul_comm _ _ _⟩
360-
361-
instance _root_.smul_comm_class.opposite_mid {M N} [monoid N] [has_scalar M N]
362-
[is_scalar_tower M N N] :
363-
smul_comm_class M Nᵐᵒᵖ N :=
364-
⟨λ x y z, by { induction y using mul_opposite.rec, simp [smul_mul_assoc] }⟩
365-
366-
-- The above instance does not create an unwanted diamond, the two paths to
367-
-- `mul_action αᵐᵒᵖ αᵐᵒᵖ` are defeq.
368-
example [monoid α] : monoid.to_mul_action αᵐᵒᵖ = mul_opposite.mul_action α αᵐᵒᵖ := rfl
369-
370-
/-- `monoid.to_opposite_mul_action` is faithful on cancellative monoids. -/
371-
instance _root_.left_cancel_monoid.to_has_faithful_opposite_scalar [left_cancel_monoid α] :
372-
has_faithful_scalar αᵐᵒᵖ α :=
373-
⟨λ x y h, unop_injective $ mul_left_cancel (h 1)⟩
374-
375-
/-- `monoid.to_opposite_mul_action` is faithful on nontrivial cancellative monoids with zero. -/
376-
instance _root_.cancel_monoid_with_zero.to_has_faithful_opposite_scalar
377-
[cancel_monoid_with_zero α] [nontrivial α] : has_faithful_scalar αᵐᵒᵖ α :=
378-
⟨λ x y h, unop_injective $ mul_left_cancel₀ one_ne_zero (h 1)⟩
379-
380296
variable {α}
381297

382298
lemma semiconj_by.op [has_mul α] {a x y : α} (h : semiconj_by a x y) :

src/algebra/order/field.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright (c) 2014 Robert Lewis. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Robert Lewis, Leonardo de Moura, Mario Carneiro, Floris van Doorn
55
-/
6-
import algebra.field
6+
import algebra.field.basic
77
import algebra.group_power.order
88
import algebra.order.ring
99
import tactic.monotonicity.basic

src/algebra/periodic.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Copyright (c) 2021 Benjamin Davidson. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Benjamin Davidson
55
-/
6+
import algebra.field.opposite
67
import algebra.module.basic
78
import algebra.order.archimedean
89
import data.int.parity

src/algebra/smul_with_zero.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Damiano Testa
55
-/
66
import algebra.group_power.basic
7-
import algebra.opposites
7+
import group_theory.group_action.opposite
88

99
/-!
1010
# Introduce `smul_with_zero`

0 commit comments

Comments
 (0)