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

Commit 1843bfc

Browse files
jlpacamergify[bot]
andauthored
feat(algebra/pointwise): pointwise scalar-multiplication lemmas (#1925)
* feat(algebra/pointwise): more lemmas about scaling sets - rename `smul_set` to `scale_set` for disambiguation - define `scale_set_action`, which subsumes `one_smul_set` - additional lemmas lemmas * fix(analysis/convex): refactor proofs for `scale_set` * feat(algebra/pointwise): re-organise file - subsume `pointwise_mul_action` * feat(algebra/pointwise): remove `pointwise_mul_action` - subsumed by `smul_set_action` with left-regular action. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 58899d4 commit 1843bfc

File tree

3 files changed

+82
-55
lines changed

3 files changed

+82
-55
lines changed

src/algebra/pointwise.lean

Lines changed: 68 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,48 @@ def pointwise_add_fintype [has_add α] [decidable_eq α] (s t : set α) [hs : fi
189189

190190
attribute [to_additive] set.pointwise_mul_fintype
191191

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+
192234
section monoid
193235

194236
def pointwise_mul_semiring [monoid α] : semiring (set α) :=
@@ -220,6 +262,19 @@ from @additive.add_comm_monoid _ set.comm_monoid
220262

221263
attribute [to_additive set.add_comm_monoid] set.comm_monoid
222264

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+
223278
section is_mul_hom
224279
open is_mul_hom
225280

@@ -253,56 +308,8 @@ lemma pointwise_mul_image_is_semiring_hom : is_semiring_hom (image f) :=
253308
map_add := image_union _,
254309
map_mul := image_pointwise_mul _ }
255310

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-
281311
end monoid
282312

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-
306313
end set
307314

308315
section
@@ -318,8 +325,19 @@ containing 0 in the semimodule. -/
318325
lemma zero_smul_set [semiring α] [add_comm_monoid β] [semimodule α β]
319326
{s : set β} (h : s ≠ ∅) : (0 : α) • s = {(0 : β)} :=
320327
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] }))
322329
(λ 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) _ _)
324342

325343
end

src/analysis/convex/basic.lean

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ lemma convex.neg_preimage (hs : convex s) : convex ((λ z, -z) ⁻¹' s) :=
223223
hs.is_linear_preimage is_linear_map.is_linear_map_neg
224224

225225
lemma convex.smul (c : ℝ) (hs : convex s) : convex (c • s) :=
226-
hs.is_linear_image (is_linear_map.is_linear_map_smul c)
226+
begin
227+
rw smul_set_eq_image,
228+
exact hs.is_linear_image (is_linear_map.is_linear_map_smul c)
229+
end
227230

228231
lemma convex.smul_preimage (c : ℝ) (hs : convex s) : convex ((λ z, c • z) ⁻¹' s) :=
229232
hs.is_linear_preimage (is_linear_map.is_linear_map_smul c)
@@ -245,7 +248,7 @@ end
245248
lemma convex.affinity (hs : convex s) (z : E) (c : ℝ) : convex ((λx, z + c • x) '' s) :=
246249
begin
247250
convert (hs.smul c).translate z using 1,
248-
erw [image_comp]
251+
erw [smul_set_eq_image, ←image_comp]
249252
end
250253

251254
lemma convex_real_iff {s : set ℝ} :

src/analysis/convex/topology.lean

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,17 @@ convex_iff_pointwise_add_subset.mpr $ λ a b ha hb hab,
7979
or.elim (classical.em (a = 0))
8080
(λ heq,
8181
have hne : b ≠ 0, by { rw [heq, zero_add] at hab, rw hab, exact one_ne_zero },
82-
is_open_pointwise_add_left ((is_open_map_smul_of_ne_zero hne _) is_open_interior))
82+
(smul_set_eq_image b (interior s)).symm ▸
83+
(is_open_pointwise_add_left ((is_open_map_smul_of_ne_zero hne _) is_open_interior)))
8384
(λ hne,
84-
is_open_pointwise_add_right ((is_open_map_smul_of_ne_zero hne _) is_open_interior)),
85+
(smul_set_eq_image a (interior s)).symm ▸
86+
(is_open_pointwise_add_right ((is_open_map_smul_of_ne_zero hne _) is_open_interior))),
8587
(subset_interior_iff_subset_of_open h).mpr $ subset.trans
86-
(by { apply pointwise_add_subset_add; exact image_subset _ interior_subset })
88+
begin
89+
apply pointwise_add_subset_add;
90+
rw [smul_set_eq_image, smul_set_eq_image];
91+
exact image_subset _ interior_subset
92+
end
8793
(convex_iff_pointwise_add_subset.mp hs ha hb hab)
8894

8995
/-- In a topological vector space, the closure of a convex set is convex. -/

0 commit comments

Comments
 (0)