Skip to content

Commit 7950cd5

Browse files
committed
feat (RingTheory/HahnSeries/Multiplication): Add group instances to HahnModule (leanprover-community#29772)
This PR adds `Zero` and `AddCommGroup` instances to `HahnModule` when appropriate. We also add comparison lemmas for subtraction in the `AddCommGroup` case, and reorganize some `variables`.
1 parent b1b0f15 commit 7950cd5

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

Mathlib/RingTheory/HahnSeries/Multiplication.lean

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,24 +141,33 @@ end
141141

142142
section SMul
143143

144-
variable [PartialOrder Γ] [AddCommMonoid V] [SMul R V]
144+
variable [PartialOrder Γ] [SMul R V]
145145

146-
instance instAddCommMonoid : AddCommMonoid (HahnModule Γ R V) :=
146+
instance instZero [Zero V] : Zero (HahnModule Γ R V) :=
147+
inferInstanceAs <| Zero (HahnSeries Γ V)
148+
instance instAddCommMonoid [AddCommMonoid V] : AddCommMonoid (HahnModule Γ R V) :=
147149
inferInstanceAs <| AddCommMonoid (HahnSeries Γ V)
150+
instance instAddCommGroup [AddCommGroup V] : AddCommGroup (HahnModule Γ R V) :=
151+
inferInstanceAs <| AddCommGroup (HahnSeries Γ V)
148152
instance instBaseSMul {V} [Monoid R] [AddMonoid V] [DistribMulAction R V] :
149153
SMul R (HahnModule Γ R V) :=
150154
inferInstanceAs <| SMul R (HahnSeries Γ V)
151155

152-
@[simp] theorem of_zero : of R (0 : HahnSeries Γ V) = 0 := rfl
153-
@[simp] theorem of_add (x y : HahnSeries Γ V) : of R (x + y) = of R x + of R y := rfl
156+
@[simp] theorem of_zero [Zero V] : of R (0 : HahnSeries Γ V) = 0 := rfl
157+
@[simp] theorem of_add [AddCommMonoid V] (x y : HahnSeries Γ V) :
158+
of R (x + y) = of R x + of R y := rfl
159+
@[simp] theorem of_sub [AddCommGroup V] (x y : HahnSeries Γ V) :
160+
of R (x - y) = of R x - of R y := rfl
154161

155-
@[simp] theorem of_symm_zero : (of R).symm (0 : HahnModule Γ R V) = 0 := rfl
156-
@[simp] theorem of_symm_add (x y : HahnModule Γ R V) :
162+
@[simp] theorem of_symm_zero [Zero V] : (of R).symm (0 : HahnModule Γ R V) = 0 := rfl
163+
@[simp] theorem of_symm_add [AddCommMonoid V] (x y : HahnModule Γ R V) :
157164
(of R).symm (x + y) = (of R).symm x + (of R).symm y := rfl
165+
@[simp] theorem of_symm_sub [AddCommGroup V] (x y : HahnModule Γ R V) :
166+
(of R).symm (x - y) = (of R).symm x - (of R).symm y := rfl
158167

159-
variable [PartialOrder Γ'] [VAdd Γ Γ'] [IsOrderedCancelVAdd Γ Γ']
168+
variable [PartialOrder Γ'] [VAdd Γ Γ'] [IsOrderedCancelVAdd Γ Γ'] [Zero R] [AddCommMonoid V]
160169

161-
instance instSMul [Zero R] : SMul (HahnSeries Γ R) (HahnModule Γ' R V) where
170+
instance instSMul : SMul (HahnSeries Γ R) (HahnModule Γ' R V) where
162171
smul x y := (of R) {
163172
coeff := fun a =>
164173
∑ ij ∈ VAddAntidiagonal x.isPWO_support ((of R).symm y).isPWO_support a,
@@ -175,7 +184,7 @@ instance instSMul [Zero R] : SMul (HahnSeries Γ R) (HahnModule Γ' R V) where
175184
simp [not_nonempty_iff_eq_empty.1 ha]
176185
isPWO_support_vaddAntidiagonal.mono h }
177186

178-
theorem coeff_smul [Zero R] (x : HahnSeries Γ R) (y : HahnModule Γ' R V) (a : Γ') :
187+
theorem coeff_smul (x : HahnSeries Γ R) (y : HahnModule Γ' R V) (a : Γ') :
179188
((of R).symm <| x • y).coeff a =
180189
∑ ij ∈ VAddAntidiagonal x.isPWO_support ((of R).symm y).isPWO_support a,
181190
x.coeff ij.fst • ((of R).symm y).coeff ij.snd :=

0 commit comments

Comments
 (0)