Skip to content

Commit b5adc12

Browse files
committed
more algebra thoughts
1 parent 22952f6 commit b5adc12

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

FLT/ForMathlib/Algebra.lean

+97
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ in what generality.
1414

1515
namespace OreLocalization
1616

17+
section CommMagma
18+
1719
variable {R A : Type*} [CommMonoid R] [CommMagma A] [MulAction R A] [IsScalarTower R A A]
1820
{S : Submonoid R}
1921

@@ -72,8 +74,85 @@ protected def mul : A[S⁻¹] → A[S⁻¹] → A[S⁻¹] :=
7274
instance : Mul (A[S⁻¹]) where
7375
mul := OreLocalization.mul
7476

77+
protected def mul_def (a : A) (s : { x // x ∈ S }) (b : A) (t : { x // x ∈ S }) :
78+
a /ₒ s * (b /ₒ t) = a * b /ₒ (t * s) := rfl
79+
7580
unseal OreLocalization.smul in
7681
example (as bt : R[S⁻¹]) : as * bt = as • bt := rfl
82+
83+
end CommMagma
84+
85+
section One
86+
87+
variable {R A : Type*} [CommMonoid R] [MulAction R A] [One A] --[MulAction R A] [IsScalarTower R A A]
88+
{S : Submonoid R}
89+
90+
instance : One (A[S⁻¹]) where
91+
one := 1 /ₒ 1
92+
93+
protected lemma one_def' : (1 : A[S⁻¹]) = 1 /ₒ 1 := rfl
94+
95+
end One
96+
97+
section CommMonoid
98+
99+
variable {R A : Type*} [CommMonoid R] [CommMonoid A] [MulAction R A] [IsScalarTower R A A]
100+
{S : Submonoid R}
101+
102+
instance commMonoid : CommMonoid (A[S⁻¹]) where
103+
mul_assoc a b c := by
104+
induction' a with a
105+
induction' b with b
106+
induction' c with c
107+
change (a * b * c) /ₒ _ = (a * (b * c)) /ₒ _
108+
simp [mul_assoc]
109+
one_mul a := by
110+
induction' a with a
111+
change (1 * a) /ₒ _ = a /ₒ _
112+
simp
113+
mul_one a := by
114+
induction' a with a s
115+
simp [OreLocalization.mul_def, OreLocalization.one_def']
116+
mul_comm a b := by
117+
induction' a with a
118+
induction' b with b
119+
simp only [OreLocalization.mul_def, mul_comm]
120+
121+
end CommMonoid
122+
123+
section CommSemiring
124+
125+
variable {R A : Type*} [CommMonoid R] [CommRing A] [DistribMulAction R A] [IsScalarTower R A A]
126+
{S : Submonoid R}
127+
128+
lemma left_distrib' (a b c : A[S⁻¹]) :
129+
a * (b + c) = a * b + a * c := by
130+
induction' a with a s
131+
induction' b with b t
132+
induction' c with c u
133+
rcases oreDivAddChar' b c t u with ⟨r₁, s₁, h₁, q⟩; rw [q]; clear q
134+
simp only [OreLocalization.mul_def]
135+
rcases oreDivAddChar' (a * b) (a * c) (t * s) (u * s) with ⟨r₂, s₂, h₂, q⟩; rw [q]; clear q
136+
rw [oreDiv_eq_iff]
137+
sorry
138+
139+
instance : CommSemiring A[S⁻¹] where
140+
__ := commMonoid
141+
left_distrib := left_distrib'
142+
right_distrib a b c := by
143+
rw [mul_comm, mul_comm a, mul_comm b, left_distrib']
144+
zero_mul a := by
145+
induction' a with a s
146+
rw [OreLocalization.zero_def, OreLocalization.mul_def]
147+
simp
148+
mul_zero a := by
149+
induction' a with a s
150+
rw [OreLocalization.zero_def, OreLocalization.mul_def]
151+
simp
152+
153+
end CommSemiring
154+
155+
77156
-- fails on mathlib master;
78157
-- works if irreducibiliy of OreLocalization.smul is removed
79158

@@ -90,4 +169,22 @@ units of `T`, to a ring homomorphism `R[S⁻¹] →+* T`. This extends the const
90169
monoids. -/
91170
def universalHom : R[S⁻¹] →+* T :=
92171
-/
172+
173+
174+
section first_goal
175+
176+
variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A] {S : Submonoid R}
177+
178+
abbrev SR := R[S⁻¹]
179+
abbrev SA := A[S⁻¹]
180+
181+
182+
unseal OreLocalization.smul in
183+
instance : Algebra (R[S⁻¹]) (A[S⁻¹]) where
184+
/-
185+
error:
186+
failed to synthesize
187+
Semiring (OreLocalization S A)
188+
-/
189+
93190
end OreLocalization

0 commit comments

Comments
 (0)