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

Commit c66ecd3

Browse files
committed
feat(intervals/image_preimage): preimage under multiplication (#3757)
Add lemmas `preimage_mul_const_Ixx` and `preimage_const_mul_Ixx`. Also generalize `equiv.mul_left` and `equiv.mul_right` to `units`.
1 parent f912f18 commit c66ecd3

File tree

5 files changed

+171
-22
lines changed

5 files changed

+171
-22
lines changed

src/algebra/ordered_field.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@ by rw [mul_comm, div_lt_iff hc]
382382
lemma div_lt_iff_of_neg (hc : c < 0) : b / c < a ↔ a * c < b :=
383383
⟨mul_lt_of_neg_of_div_lt hc, div_lt_of_neg_of_mul_lt hc⟩
384384

385+
lemma lt_div_iff_of_neg (hc : c < 0) : a < b / c ↔ b < a * c :=
386+
by rw [← neg_neg c, div_neg, lt_neg, div_lt_iff (neg_pos.2 hc), ← neg_mul_eq_neg_mul,
387+
← neg_mul_eq_mul_neg _ (-c)]
388+
385389
lemma inv_le_inv (ha : 0 < a) (hb : 0 < b) : a⁻¹ ≤ b⁻¹ ↔ b ≤ a :=
386390
by rw [inv_eq_one_div, div_le_iff ha,
387391
← div_eq_inv_mul, one_le_div_iff_le hb]

src/data/equiv/mul_add.lean

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ by refine_struct { to_fun := add_equiv.to_equiv }; intros; refl
304304
end add_aut
305305

306306
/-- A group is isomorphic to its group of units. -/
307-
def to_units (G) [group G] : G ≃* units G :=
307+
@[to_additive to_add_units "An additive group is isomorphic to its group of additive units"]
308+
def to_units {G} [group G] : G ≃* units G :=
308309
{ to_fun := λ x, ⟨x, x⁻¹, mul_inv_self _, inv_mul_self _⟩,
309310
inv_fun := coe,
310311
left_inv := λ x, rfl,
@@ -323,6 +324,36 @@ def map_equiv (h : M ≃* N) : units M ≃* units N :=
323324
right_inv := λ u, ext $ h.right_inv u,
324325
.. map h.to_monoid_hom }
325326

327+
/-- Left multiplication by a unit of a monoid is a permutation of the underlying type. -/
328+
@[to_additive "Left addition of an additive unit is a permutation of the underlying type."]
329+
def mul_left (u : units M) : equiv.perm M :=
330+
{ to_fun := λx, u * x,
331+
inv_fun := λx, ↑u⁻¹ * x,
332+
left_inv := u.inv_mul_cancel_left,
333+
right_inv := u.mul_inv_cancel_left }
334+
335+
@[simp, to_additive]
336+
lemma coe_mul_left (u : units M) : ⇑u.mul_left = (*) u := rfl
337+
338+
@[simp, to_additive]
339+
lemma mul_left_symm (u : units M) : u.mul_left.symm = u⁻¹.mul_left :=
340+
equiv.ext $ λ x, rfl
341+
342+
/-- Right multiplication by a unit of a monoid is a permutation of the underlying type. -/
343+
@[to_additive "Right addition of an additive unit is a permutation of the underlying type."]
344+
def mul_right (u : units M) : equiv.perm M :=
345+
{ to_fun := λx, x * u,
346+
inv_fun := λx, x * ↑u⁻¹,
347+
left_inv := λ x, mul_inv_cancel_right x u,
348+
right_inv := λ x, inv_mul_cancel_right x u }
349+
350+
@[simp, to_additive]
351+
lemma coe_mul_right (u : units M) : ⇑u.mul_right = λ x : M, x * u := rfl
352+
353+
@[simp, to_additive]
354+
lemma mul_right_symm (u : units M) : u.mul_right.symm = u⁻¹.mul_right :=
355+
equiv.ext $ λ x, rfl
356+
326357
end units
327358

328359
namespace equiv
@@ -332,11 +363,7 @@ variables [group G]
332363

333364
/-- Left multiplication in a `group` is a permutation of the underlying type. -/
334365
@[to_additive "Left addition in an `add_group` is a permutation of the underlying type."]
335-
protected def mul_left (a : G) : perm G :=
336-
{ to_fun := λx, a * x,
337-
inv_fun := λx, a⁻¹ * x,
338-
left_inv := assume x, show a⁻¹ * (a * x) = x, from inv_mul_cancel_left a x,
339-
right_inv := assume x, show a * (a⁻¹ * x) = x, from mul_inv_cancel_left a x }
366+
protected def mul_left (a : G) : perm G := (to_units a).mul_left
340367

341368
@[simp, to_additive]
342369
lemma coe_mul_left (a : G) : ⇑(equiv.mul_left a) = (*) a := rfl
@@ -347,11 +374,7 @@ ext $ λ x, rfl
347374

348375
/-- Right multiplication in a `group` is a permutation of the underlying type. -/
349376
@[to_additive "Right addition in an `add_group` is a permutation of the underlying type."]
350-
protected def mul_right (a : G) : perm G :=
351-
{ to_fun := λx, x * a,
352-
inv_fun := λx, x * a⁻¹,
353-
left_inv := assume x, show (x * a) * a⁻¹ = x, from mul_inv_cancel_right x a,
354-
right_inv := assume x, show (x * a⁻¹) * a = x, from inv_mul_cancel_right x a }
377+
protected def mul_right (a : G) : perm G := (to_units a).mul_right
355378

356379
@[simp, to_additive]
357380
lemma coe_mul_right (a : G) : ⇑(equiv.mul_right a) = λ x, x * a := rfl

src/data/set/intervals/image_preimage.lean

Lines changed: 130 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,17 +278,139 @@ section linear_ordered_field
278278

279279
variables {k : Type u} [linear_ordered_field k]
280280

281+
@[simp] lemma preimage_mul_const_Iio (a : k) {c : k} (h : 0 < c) :
282+
(λ x, x * c) ⁻¹' (Iio a) = Iio (a / c) :=
283+
ext $ λ x, (lt_div_iff h).symm
284+
285+
@[simp] lemma preimage_mul_const_Ioi (a : k) {c : k} (h : 0 < c) :
286+
(λ x, x * c) ⁻¹' (Ioi a) = Ioi (a / c) :=
287+
ext $ λ x, (div_lt_iff h).symm
288+
289+
@[simp] lemma preimage_mul_const_Iic (a : k) {c : k} (h : 0 < c) :
290+
(λ x, x * c) ⁻¹' (Iic a) = Iic (a / c) :=
291+
ext $ λ x, (le_div_iff h).symm
292+
293+
@[simp] lemma preimage_mul_const_Ici (a : k) {c : k} (h : 0 < c) :
294+
(λ x, x * c) ⁻¹' (Ici a) = Ici (a / c) :=
295+
ext $ λ x, (div_le_iff h).symm
296+
297+
@[simp] lemma preimage_mul_const_Ioo (a b : k) {c : k} (h : 0 < c) :
298+
(λ x, x * c) ⁻¹' (Ioo a b) = Ioo (a / c) (b / c) :=
299+
by simp [← Ioi_inter_Iio, h]
300+
301+
@[simp] lemma preimage_mul_const_Ioc (a b : k) {c : k} (h : 0 < c) :
302+
(λ x, x * c) ⁻¹' (Ioc a b) = Ioc (a / c) (b / c) :=
303+
by simp [← Ioi_inter_Iic, h]
304+
305+
@[simp] lemma preimage_mul_const_Ico (a b : k) {c : k} (h : 0 < c) :
306+
(λ x, x * c) ⁻¹' (Ico a b) = Ico (a / c) (b / c) :=
307+
by simp [← Ici_inter_Iio, h]
308+
309+
@[simp] lemma preimage_mul_const_Icc (a b : k) {c : k} (h : 0 < c) :
310+
(λ x, x * c) ⁻¹' (Icc a b) = Icc (a / c) (b / c) :=
311+
by simp [← Ici_inter_Iic, h]
312+
313+
@[simp] lemma preimage_mul_const_Iio_of_neg (a : k) {c : k} (h : c < 0) :
314+
(λ x, x * c) ⁻¹' (Iio a) = Ioi (a / c) :=
315+
ext $ λ x, (div_lt_iff_of_neg h).symm
316+
317+
@[simp] lemma preimage_mul_const_Ioi_of_neg (a : k) {c : k} (h : c < 0) :
318+
(λ x, x * c) ⁻¹' (Ioi a) = Iio (a / c) :=
319+
ext $ λ x, (lt_div_iff_of_neg h).symm
320+
321+
@[simp] lemma preimage_mul_const_Iic_of_neg (a : k) {c : k} (h : c < 0) :
322+
(λ x, x * c) ⁻¹' (Iic a) = Ici (a / c) :=
323+
ext $ λ x, (div_le_iff_of_neg h).symm
324+
325+
@[simp] lemma preimage_mul_const_Ici_of_neg (a : k) {c : k} (h : c < 0) :
326+
(λ x, x * c) ⁻¹' (Ici a) = Iic (a / c) :=
327+
ext $ λ x, (le_div_iff_of_neg h).symm
328+
329+
@[simp] lemma preimage_mul_const_Ioo_of_neg (a b : k) {c : k} (h : c < 0) :
330+
(λ x, x * c) ⁻¹' (Ioo a b) = Ioo (b / c) (a / c) :=
331+
by simp [← Ioi_inter_Iio, h, inter_comm]
332+
333+
@[simp] lemma preimage_mul_const_Ioc_of_neg (a b : k) {c : k} (h : c < 0) :
334+
(λ x, x * c) ⁻¹' (Ioc a b) = Ico (b / c) (a / c) :=
335+
by simp [← Ioi_inter_Iic, ← Ici_inter_Iio, h, inter_comm]
336+
337+
@[simp] lemma preimage_mul_const_Ico_of_neg (a b : k) {c : k} (h : c < 0) :
338+
(λ x, x * c) ⁻¹' (Ico a b) = Ioc (b / c) (a / c) :=
339+
by simp [← Ici_inter_Iio, ← Ioi_inter_Iic, h, inter_comm]
340+
341+
@[simp] lemma preimage_mul_const_Icc_of_neg (a b : k) {c : k} (h : c < 0) :
342+
(λ x, x * c) ⁻¹' (Icc a b) = Icc (b / c) (a / c) :=
343+
by simp [← Ici_inter_Iic, h, inter_comm]
344+
345+
@[simp] lemma preimage_const_mul_Iio (a : k) {c : k} (h : 0 < c) :
346+
((*) c) ⁻¹' (Iio a) = Iio (a / c) :=
347+
ext $ λ x, (lt_div_iff' h).symm
348+
349+
@[simp] lemma preimage_const_mul_Ioi (a : k) {c : k} (h : 0 < c) :
350+
((*) c) ⁻¹' (Ioi a) = Ioi (a / c) :=
351+
ext $ λ x, (div_lt_iff' h).symm
352+
353+
@[simp] lemma preimage_const_mul_Iic (a : k) {c : k} (h : 0 < c) :
354+
((*) c) ⁻¹' (Iic a) = Iic (a / c) :=
355+
ext $ λ x, (le_div_iff' h).symm
356+
357+
@[simp] lemma preimage_const_mul_Ici (a : k) {c : k} (h : 0 < c) :
358+
((*) c) ⁻¹' (Ici a) = Ici (a / c) :=
359+
ext $ λ x, (div_le_iff' h).symm
360+
361+
@[simp] lemma preimage_const_mul_Ioo (a b : k) {c : k} (h : 0 < c) :
362+
((*) c) ⁻¹' (Ioo a b) = Ioo (a / c) (b / c) :=
363+
by simp [← Ioi_inter_Iio, h]
364+
365+
@[simp] lemma preimage_const_mul_Ioc (a b : k) {c : k} (h : 0 < c) :
366+
((*) c) ⁻¹' (Ioc a b) = Ioc (a / c) (b / c) :=
367+
by simp [← Ioi_inter_Iic, h]
368+
369+
@[simp] lemma preimage_const_mul_Ico (a b : k) {c : k} (h : 0 < c) :
370+
((*) c) ⁻¹' (Ico a b) = Ico (a / c) (b / c) :=
371+
by simp [← Ici_inter_Iio, h]
372+
373+
@[simp] lemma preimage_const_mul_Icc (a b : k) {c : k} (h : 0 < c) :
374+
((*) c) ⁻¹' (Icc a b) = Icc (a / c) (b / c) :=
375+
by simp [← Ici_inter_Iic, h]
376+
377+
@[simp] lemma preimage_const_mul_Iio_of_neg (a : k) {c : k} (h : c < 0) :
378+
((*) c) ⁻¹' (Iio a) = Ioi (a / c) :=
379+
by simpa only [mul_comm] using preimage_mul_const_Iio_of_neg a h
380+
381+
@[simp] lemma preimage_const_mul_Ioi_of_neg (a : k) {c : k} (h : c < 0) :
382+
((*) c) ⁻¹' (Ioi a) = Iio (a / c) :=
383+
by simpa only [mul_comm] using preimage_mul_const_Ioi_of_neg a h
384+
385+
@[simp] lemma preimage_const_mul_Iic_of_neg (a : k) {c : k} (h : c < 0) :
386+
((*) c) ⁻¹' (Iic a) = Ici (a / c) :=
387+
by simpa only [mul_comm] using preimage_mul_const_Iic_of_neg a h
388+
389+
@[simp] lemma preimage_const_mul_Ici_of_neg (a : k) {c : k} (h : c < 0) :
390+
((*) c) ⁻¹' (Ici a) = Iic (a / c) :=
391+
by simpa only [mul_comm] using preimage_mul_const_Ici_of_neg a h
392+
393+
@[simp] lemma preimage_const_mul_Ioo_of_neg (a b : k) {c : k} (h : c < 0) :
394+
((*) c) ⁻¹' (Ioo a b) = Ioo (b / c) (a / c) :=
395+
by simpa only [mul_comm] using preimage_mul_const_Ioo_of_neg a b h
396+
397+
@[simp] lemma preimage_const_mul_Ioc_of_neg (a b : k) {c : k} (h : c < 0) :
398+
((*) c) ⁻¹' (Ioc a b) = Ico (b / c) (a / c) :=
399+
by simpa only [mul_comm] using preimage_mul_const_Ioc_of_neg a b h
400+
401+
@[simp] lemma preimage_const_mul_Ico_of_neg (a b : k) {c : k} (h : c < 0) :
402+
((*) c) ⁻¹' (Ico a b) = Ioc (b / c) (a / c) :=
403+
by simpa only [mul_comm] using preimage_mul_const_Ico_of_neg a b h
404+
405+
@[simp] lemma preimage_const_mul_Icc_of_neg (a b : k) {c : k} (h : c < 0) :
406+
((*) c) ⁻¹' (Icc a b) = Icc (b / c) (a / c) :=
407+
by simpa only [mul_comm] using preimage_mul_const_Icc_of_neg a b h
408+
281409
lemma image_mul_right_Icc' (a b : k) {c : k} (h : 0 < c) :
282410
(λ x, x * c) '' Icc a b = Icc (a * c) (b * c) :=
283411
begin
284-
ext x,
285-
split,
286-
{ rintros ⟨x, hx, rfl⟩,
287-
exact ⟨mul_le_mul_of_nonneg_right hx.1 (le_of_lt h),
288-
mul_le_mul_of_nonneg_right hx.2 (le_of_lt h)⟩ },
289-
{ intro hx,
290-
refine ⟨x / c, _, div_mul_cancel x (ne_of_gt h)⟩,
291-
exact ⟨le_div_of_mul_le h hx.1, div_le_of_le_mul h (mul_comm b c ▸ hx.2)⟩ }
412+
refine ((units.mk0 c (ne_of_gt h)).mul_right.image_eq_preimage _).trans _,
413+
simp [h, division_def]
292414
end
293415

294416
lemma image_mul_right_Icc {a b c : k} (hab : a ≤ b) (hc : 0 ≤ c) :

src/dynamics/circle/rotation_number/translation_number.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ ext_iff
128128
`multiplicative ℝ` to `units circle_deg1_lift`, so the translation by `x` is
129129
`translation (multiplicative.of_add x)`. -/
130130
def translate : multiplicative ℝ →* units circle_deg1_lift :=
131-
by refine (units.map _).comp (to_units $ multiplicative ℝ).to_monoid_hom; exact
131+
by refine (units.map _).comp to_units.to_monoid_hom; exact
132132
{ to_fun := λ x, ⟨λ y, x.to_add + y, λ y₁ y₂ h, add_le_add_left h _, λ y, (add_assoc _ _ _).symm⟩,
133133
map_one' := ext $ zero_add,
134134
map_mul' := λ x y, ext $ add_assoc _ _ }

src/group_theory/group_action.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ section
205205
open mul_action quotient_group
206206

207207
@[simp] lemma inv_smul_smul (c : α) (x : β) : c⁻¹ • c • x = x :=
208-
(to_units α c).inv_smul_smul x
208+
(to_units c).inv_smul_smul x
209209

210210
@[simp] lemma smul_inv_smul (c : α) (x : β) : c • c⁻¹ • x = x :=
211-
(to_units α c).smul_inv_smul x
211+
(to_units c).smul_inv_smul x
212212

213213
lemma inv_smul_eq_iff {a : α} {x y : β} : a⁻¹ • x = y ↔ x = a • y :=
214214
begin

0 commit comments

Comments
 (0)