@@ -38,29 +38,75 @@ class mul_zero_class (M₀ : Type*) extends has_mul M₀, has_zero M₀ :=
38
38
(zero_mul : ∀ a : M₀, 0 * a = 0 )
39
39
(mul_zero : ∀ a : M₀, a * 0 = 0 )
40
40
41
+ section mul_zero_class
42
+
43
+ variables [mul_zero_class M₀] {a b : M₀}
44
+
45
+ @[ematch, simp] lemma zero_mul (a : M₀) : 0 * a = 0 :=
46
+ mul_zero_class.zero_mul a
47
+
48
+ @[ematch, simp] lemma mul_zero (a : M₀) : a * 0 = 0 :=
49
+ mul_zero_class.mul_zero a
50
+
51
+ end mul_zero_class
52
+
41
53
/-- A mixin for left cancellative multiplication by nonzero elements. -/
42
54
@[protect_proj] class is_left_cancel_mul_zero (M₀ : Type u) [has_mul M₀] [has_zero M₀] : Prop :=
43
55
(mul_left_cancel_of_ne_zero : ∀ {a b c : M₀}, a ≠ 0 → a * b = a * c → b = c)
44
56
57
+ section is_left_cancel_mul_zero
58
+
59
+ variables [has_mul M₀] [has_zero M₀] [is_left_cancel_mul_zero M₀] {a b c : M₀}
60
+
61
+ lemma mul_left_cancel₀ (ha : a ≠ 0 ) (h : a * b = a * c) : b = c :=
62
+ is_left_cancel_mul_zero.mul_left_cancel_of_ne_zero ha h
63
+
64
+ lemma mul_right_injective₀ (ha : a ≠ 0 ) : function.injective ((*) a) :=
65
+ λ b c, mul_left_cancel₀ ha
66
+
67
+ end is_left_cancel_mul_zero
68
+
45
69
/-- A mixin for right cancellative multiplication by nonzero elements. -/
46
70
@[protect_proj] class is_right_cancel_mul_zero (M₀ : Type u) [has_mul M₀] [has_zero M₀] : Prop :=
47
71
(mul_right_cancel_of_ne_zero : ∀ {a b c : M₀}, b ≠ 0 → a * b = c * b → a = c)
48
72
73
+ section is_right_cancel_mul_zero
74
+
75
+ variables [has_mul M₀] [has_zero M₀] [is_right_cancel_mul_zero M₀] {a b c : M₀}
76
+
77
+ lemma mul_right_cancel₀ (hb : b ≠ 0 ) (h : a * b = c * b) : a = c :=
78
+ is_right_cancel_mul_zero.mul_right_cancel_of_ne_zero hb h
79
+
80
+ lemma mul_left_injective₀ (hb : b ≠ 0 ) : function.injective (λ a, a * b) :=
81
+ λ a c, mul_right_cancel₀ hb
82
+
83
+ end is_right_cancel_mul_zero
84
+
49
85
/-- A mixin for cancellative multiplication by nonzero elements. -/
50
86
@[protect_proj] class is_cancel_mul_zero (M₀ : Type u) [has_mul M₀] [has_zero M₀]
51
87
extends is_left_cancel_mul_zero M₀, is_right_cancel_mul_zero M₀ : Prop
52
88
53
- section mul_zero_class
89
+ section comm_semigroup_with_zero
54
90
55
- variables [mul_zero_class M₀] {a b : M₀}
91
+ variables [comm_semigroup M₀] [has_zero M₀]
56
92
57
- @[ematch, simp] lemma zero_mul (a : M₀) : 0 * a = 0 :=
58
- mul_zero_class.zero_mul a
93
+ lemma is_left_cancel_mul_zero.to_is_right_cancel_mul_zero [is_left_cancel_mul_zero M₀] :
94
+ is_right_cancel_mul_zero M₀ :=
95
+ ⟨λ a b c ha h, mul_left_cancel₀ ha $ (mul_comm _ _).trans $ (h.trans (mul_comm _ _))⟩
59
96
60
- @[ematch, simp] lemma mul_zero (a : M₀) : a * 0 = 0 :=
61
- mul_zero_class.mul_zero a
97
+ lemma is_right_cancel_mul_zero.to_is_left_cancel_mul_zero [is_right_cancel_mul_zero M₀] :
98
+ is_left_cancel_mul_zero M₀ :=
99
+ ⟨λ a b c ha h, mul_right_cancel₀ ha $ (mul_comm _ _).trans $ (h.trans (mul_comm _ _))⟩
62
100
63
- end mul_zero_class
101
+ lemma is_left_cancel_mul_zero.to_is_cancel_mul_zero [is_left_cancel_mul_zero M₀] :
102
+ is_cancel_mul_zero M₀ :=
103
+ { .. ‹is_left_cancel_mul_zero M₀›, .. is_left_cancel_mul_zero.to_is_right_cancel_mul_zero }
104
+
105
+ lemma is_right_cancel_mul_zero.to_is_cancel_mul_zero [is_right_cancel_mul_zero M₀] :
106
+ is_cancel_mul_zero M₀ :=
107
+ { .. ‹is_right_cancel_mul_zero M₀›, .. is_right_cancel_mul_zero.to_is_left_cancel_mul_zero }
108
+
109
+ end comm_semigroup_with_zero
64
110
65
111
/-- Predicate typeclass for expressing that `a * b = 0` implies `a = 0` or `b = 0`
66
112
for all `a` and `b` of type `G₀`. -/
@@ -97,31 +143,11 @@ class cancel_monoid_with_zero (M₀ : Type*) extends monoid_with_zero M₀ :=
97
143
(mul_left_cancel_of_ne_zero : ∀ {a b c : M₀}, a ≠ 0 → a * b = a * c → b = c)
98
144
(mul_right_cancel_of_ne_zero : ∀ {a b c : M₀}, b ≠ 0 → a * b = c * b → a = c)
99
145
100
- section cancel_monoid_with_zero
101
-
102
- variables [cancel_monoid_with_zero M₀] {a b c : M₀}
103
-
104
- lemma mul_left_cancel₀ (ha : a ≠ 0 ) (h : a * b = a * c) : b = c :=
105
- cancel_monoid_with_zero.mul_left_cancel_of_ne_zero ha h
106
-
107
- lemma mul_right_cancel₀ (hb : b ≠ 0 ) (h : a * b = c * b) : a = c :=
108
- cancel_monoid_with_zero.mul_right_cancel_of_ne_zero hb h
109
-
110
- lemma mul_right_injective₀ (ha : a ≠ 0 ) : function.injective ((*) a) :=
111
- λ b c, mul_left_cancel₀ ha
112
-
113
- lemma mul_left_injective₀ (hb : b ≠ 0 ) : function.injective (λ a, a * b) :=
114
- λ a c, mul_right_cancel₀ hb
115
-
116
146
/-- A `cancel_monoid_with_zero` satisfies `is_cancel_mul_zero`. -/
117
147
@[priority 100 ]
118
- instance cancel_monoid_with_zero.to_is_cancel_mul_zero : is_cancel_mul_zero M₀ :=
119
- { mul_left_cancel_of_ne_zero := λ a b c ha h,
120
- cancel_monoid_with_zero.mul_left_cancel_of_ne_zero ha h,
121
- mul_right_cancel_of_ne_zero := λ a b c hb h,
122
- cancel_monoid_with_zero.mul_right_cancel_of_ne_zero hb h, }
123
-
124
- end cancel_monoid_with_zero
148
+ instance cancel_monoid_with_zero.to_is_cancel_mul_zero [cancel_monoid_with_zero M₀] :
149
+ is_cancel_mul_zero M₀ :=
150
+ { .. ‹cancel_monoid_with_zero M₀› }
125
151
126
152
/-- A type `M` is a commutative “monoid with zero” if it is a commutative monoid with zero
127
153
element, and `0` is left and right absorbing. -/
@@ -132,8 +158,13 @@ class comm_monoid_with_zero (M₀ : Type*) extends comm_monoid M₀, monoid_with
132
158
`0` is left and right absorbing,
133
159
and left/right multiplication by a non-zero element is injective. -/
134
160
@[protect_proj, ancestor comm_monoid_with_zero cancel_monoid_with_zero]
135
- class cancel_comm_monoid_with_zero (M₀ : Type *) extends
136
- comm_monoid_with_zero M₀, cancel_monoid_with_zero M₀.
161
+ class cancel_comm_monoid_with_zero (M₀ : Type *) extends comm_monoid_with_zero M₀ :=
162
+ (mul_left_cancel_of_ne_zero : ∀ {a b c : M₀}, a ≠ 0 → a * b = a * c → b = c)
163
+
164
+ @[priority 100 ]
165
+ instance cancel_comm_monoid_with_zero.to_cancel_monoid_with_zero
166
+ [h : cancel_comm_monoid_with_zero M₀] : cancel_monoid_with_zero M₀ :=
167
+ { .. h, .. @is_left_cancel_mul_zero.to_is_right_cancel_mul_zero M₀ _ _ { .. h } }
137
168
138
169
/-- A type `G₀` is a “group with zero” if it is a monoid with zero element (distinct from `1`)
139
170
such that every nonzero element is invertible.
@@ -147,42 +178,6 @@ class group_with_zero (G₀ : Type u) extends
147
178
(inv_zero : (0 : G₀)⁻¹ = 0 )
148
179
(mul_inv_cancel : ∀ a:G₀, a ≠ 0 → a * a⁻¹ = 1 )
149
180
150
- namespace comm_monoid_with_zero
151
-
152
- variable [comm_monoid_with_zero M₀]
153
-
154
- lemma is_left_cancel_mul_zero.to_is_right_cancel_mul_zero [is_left_cancel_mul_zero M₀] :
155
- is_right_cancel_mul_zero M₀ :=
156
- { mul_right_cancel_of_ne_zero := λ a b c ha h,
157
- begin
158
- rw [mul_comm, mul_comm c] at h,
159
- exact is_left_cancel_mul_zero.mul_left_cancel_of_ne_zero ha h,
160
- end }
161
-
162
- lemma is_right_cancel_mul_zero.to_is_left_cancel_mul_zero [is_right_cancel_mul_zero M₀] :
163
- is_left_cancel_mul_zero M₀ :=
164
- { mul_left_cancel_of_ne_zero := λ a b c ha h,
165
- begin
166
- rw [mul_comm a, mul_comm a c] at h,
167
- exact is_right_cancel_mul_zero.mul_right_cancel_of_ne_zero ha h,
168
- end }
169
-
170
- lemma is_left_cancel_mul_zero.to_is_cancel_mul_zero [is_left_cancel_mul_zero M₀] :
171
- is_cancel_mul_zero M₀ :=
172
- { mul_left_cancel_of_ne_zero := λ _ _ _,
173
- is_left_cancel_mul_zero.mul_left_cancel_of_ne_zero,
174
- mul_right_cancel_of_ne_zero := λ _ _ _,
175
- is_left_cancel_mul_zero.to_is_right_cancel_mul_zero.mul_right_cancel_of_ne_zero }
176
-
177
- lemma is_right_cancel_mul_zero.to_is_cancel_mul_zero [is_right_cancel_mul_zero M₀] :
178
- is_cancel_mul_zero M₀ :=
179
- { mul_left_cancel_of_ne_zero := λ _ _ _,
180
- is_right_cancel_mul_zero.to_is_left_cancel_mul_zero.mul_left_cancel_of_ne_zero,
181
- mul_right_cancel_of_ne_zero := λ _ _ _,
182
- is_right_cancel_mul_zero.mul_right_cancel_of_ne_zero }
183
-
184
- end comm_monoid_with_zero
185
-
186
181
section group_with_zero
187
182
188
183
variables [group_with_zero G₀]
0 commit comments