@@ -189,6 +189,48 @@ def pointwise_add_fintype [has_add α] [decidable_eq α] (s t : set α) [hs : fi
189
189
190
190
attribute [to_additive] set.pointwise_mul_fintype
191
191
192
+ /-- Pointwise scalar multiplication by a set of scalars. -/
193
+ def pointwise_smul [has_scalar α β] : has_scalar (set α) (set β) :=
194
+ ⟨λ s t, { x | ∃ a ∈ s, ∃ y ∈ t, x = a • y }⟩
195
+
196
+ /-- Scaling a set: multiplying every element by a scalar. -/
197
+ def smul_set [has_scalar α β] : has_scalar α (set β) :=
198
+ ⟨λ a s, { x | ∃ y ∈ s, x = a • y }⟩
199
+
200
+ local attribute [instance] pointwise_smul smul_set
201
+
202
+ lemma mem_smul_set [has_scalar α β] (a : α) (s : set β) (x : β) :
203
+ x ∈ a • s ↔ ∃ y ∈ s, x = a • y := iff.rfl
204
+
205
+ lemma smul_set_eq_image [has_scalar α β] (a : α) (s : set β) :
206
+ a • s = (λ x, a • x) '' s :=
207
+ set.ext $ λ x, iff.intro
208
+ (λ ⟨_, hy₁, hy₂⟩, ⟨_, hy₁, hy₂.symm⟩)
209
+ (λ ⟨_, hy₁, hy₂⟩, ⟨_, hy₁, hy₂.symm⟩)
210
+
211
+ lemma smul_set_eq_pointwise_smul_singleton [has_scalar α β]
212
+ (a : α) (s : set β) : a • s = ({a} : set α) • s :=
213
+ set.ext $ λ x, iff.intro
214
+ (λ ⟨_, h⟩, ⟨a, mem_singleton _, _, h⟩)
215
+ (λ ⟨_, h, y, hy, hx⟩, ⟨_, hy, by {
216
+ rw mem_singleton_iff at h; rwa h at hx }⟩)
217
+
218
+ lemma smul_mem_smul_set [has_scalar α β]
219
+ (a : α) {s : set β} {y : β} (hy : y ∈ s) : a • y ∈ a • s :=
220
+ by rw mem_smul_set; use [y, hy]
221
+
222
+ lemma smul_set_union [has_scalar α β] (a : α) (s t : set β) :
223
+ a • (s ∪ t) = a • s ∪ a • t :=
224
+ by simp only [smul_set_eq_image, image_union]
225
+
226
+ @[simp] lemma smul_set_empty [has_scalar α β] (a : α) :
227
+ a • (∅ : set β) = ∅ :=
228
+ by rw [smul_set_eq_image, image_empty]
229
+
230
+ lemma smul_set_mono [has_scalar α β]
231
+ (a : α) {s t : set β} (h : s ⊆ t) : a • s ⊆ a • t :=
232
+ by { rw [smul_set_eq_image, smul_set_eq_image], exact image_subset _ h }
233
+
192
234
section monoid
193
235
194
236
def pointwise_mul_semiring [monoid α] : semiring (set α) :=
@@ -220,6 +262,19 @@ from @additive.add_comm_monoid _ set.comm_monoid
220
262
221
263
attribute [to_additive set.add_comm_monoid] set.comm_monoid
222
264
265
+ /-- A multiplicative action of a monoid on a type β gives also a
266
+ multiplicative action on the subsets of β. -/
267
+ def smul_set_action [monoid α] [mul_action α β] :
268
+ mul_action α (set β) :=
269
+ { smul := λ a s, a • s,
270
+ mul_smul := λ a b s, set.ext $ λ x, iff.intro
271
+ (λ ⟨_, hy, _⟩, ⟨b • _, smul_mem_smul_set _ hy, by rwa ←mul_smul⟩)
272
+ (λ ⟨_, hy, _⟩, let ⟨_, hz, h⟩ := (mem_smul_set _ _ _).2 hy in
273
+ ⟨_, hz, by rwa [mul_smul, ←h]⟩),
274
+ one_smul := λ b, set.ext $ λ x, iff.intro
275
+ (λ ⟨_, _, h⟩, by { rw [one_smul] at h; rwa h })
276
+ (λ h, ⟨_, h, by rw one_smul⟩) }
277
+
223
278
section is_mul_hom
224
279
open is_mul_hom
225
280
@@ -253,56 +308,8 @@ lemma pointwise_mul_image_is_semiring_hom : is_semiring_hom (image f) :=
253
308
map_add := image_union _,
254
309
map_mul := image_pointwise_mul _ }
255
310
256
- local attribute [instance] singleton.is_monoid_hom
257
-
258
- def pointwise_mul_action : mul_action α (set α) :=
259
- { smul := λ a s, ({a} : set α) * s,
260
- one_smul := one_mul,
261
- mul_smul := λ _ _ _, show {_} * _ = _,
262
- by { erw is_monoid_hom.map_mul (singleton : α → set α), apply mul_assoc } }
263
-
264
- local attribute [instance] pointwise_mul_action
265
-
266
- lemma mem_smul_set {a : α} {s : set α} {x : α} :
267
- x ∈ a • s ↔ ∃ y ∈ s, x = a * y :=
268
- by { erw mem_pointwise_mul, simp }
269
-
270
- lemma smul_set_eq_image {a : α} {s : set α} :
271
- a • s = (λ b, a * b) '' s :=
272
- set.ext $ λ x,
273
- begin
274
- simp only [mem_smul_set, exists_prop, mem_image],
275
- apply exists_congr,
276
- intro y,
277
- apply and_congr iff.rfl,
278
- split; exact eq.symm
279
- end
280
-
281
311
end monoid
282
312
283
- /-- Pointwise scalar multiplication by a set of scalars. -/
284
- def pointwise_smul [has_scalar α β] : has_scalar (set α) (set β) :=
285
- ⟨λ s t, { x | ∃ a ∈ s, ∃ y ∈ t, x = a • y }⟩
286
-
287
- /-- Scaling a set: multiplying every element by a scalar. -/
288
- def smul_set [has_scalar α β] : has_scalar α (set β) :=
289
- ⟨λ a s, (λ y, a • y) '' s⟩
290
-
291
- local attribute [instance] pointwise_smul smul_set
292
-
293
- lemma smul_set_eq_pointwise_smul_singleton [has_scalar α β]
294
- (a : α) (s : set β) : a • s = ({a} : set α) • s :=
295
- set.ext $ λ x, iff.intro
296
- (λ ⟨_, ht, hx⟩, ⟨a, mem_singleton _, _, ht, hx.symm⟩)
297
- (λ ⟨a', ha', y, hy, hx⟩, ⟨_, hy, by {
298
- rw mem_singleton_iff at ha'; rw ha' at hx; exact hx.symm }⟩)
299
-
300
- /-- A set scaled by 1 is itself. -/
301
- lemma one_smul_set [monoid α] [mul_action α β] (s : set β) : (1 : α) • s = s :=
302
- set.ext $ λ x, iff.intro
303
- (λ ⟨y, hy, hx⟩, by { rw ←hx, show (1 : α) • y ∈ s, by rwa one_smul })
304
- (λ hx, ⟨x, hx, show (1 : α) • x = x, by rwa one_smul⟩)
305
-
306
313
end set
307
314
308
315
section
@@ -318,8 +325,19 @@ containing 0 in the semimodule. -/
318
325
lemma zero_smul_set [semiring α] [add_comm_monoid β] [semimodule α β]
319
326
{s : set β} (h : s ≠ ∅) : (0 : α) • s = {(0 : β)} :=
320
327
set.ext $ λ x, iff.intro
321
- (λ ⟨y, hy , hx⟩, mem_singleton_iff.mpr (by { rw ←hx; exact zero_smul α y }))
328
+ (λ ⟨_, _ , hx⟩, mem_singleton_iff.mpr (by { rwa [hx, zero_smul] }))
322
329
(λ hx, let ⟨_, hs⟩ := set.ne_empty_iff_exists_mem.mp h in
323
- ⟨_, hs, show (0 : α) • _ = x, by { rw mem_singleton_iff at hx; rw [hx, zero_smul] }⟩)
330
+ ⟨_, hs, by { rw mem_singleton_iff at hx; rw [hx, zero_smul] }⟩)
331
+
332
+ lemma mem_inv_smul_set_iff [field α] [mul_action α β]
333
+ {a : α} (ha : a ≠ 0 ) (A : set β) (x : β) : x ∈ a⁻¹ • A ↔ a • x ∈ A :=
334
+ iff.intro
335
+ (λ ⟨y, hy, h⟩, by rwa [h, ←mul_smul, mul_inv_cancel ha, one_smul])
336
+ (λ h, ⟨_, h, by rw [←mul_smul, inv_mul_cancel ha, one_smul]⟩)
337
+
338
+ lemma mem_smul_set_iff_inv_smul_mem [field α] [mul_action α β]
339
+ {a : α} (ha : a ≠ 0 ) (A : set β) (x : β) : x ∈ a • A ↔ a⁻¹ • x ∈ A :=
340
+ by conv_lhs { rw ←(division_ring.inv_inv ha) };
341
+ exact (mem_inv_smul_set_iff (inv_ne_zero ha) _ _)
324
342
325
343
end
0 commit comments