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

Commit 740acc0

Browse files
committed
feat(algebra/order): Unions of interval translates by ℤ (#18427)
Write a linearly ordered abelian group as a union of pairwise disjoint intervals `⋃ (n : ℤ), Ioc (a + n • b) (a + (n + 1) • b)` (in multiple variations). Split off from #18425, which in turn was split from #18392.
1 parent 5455cb0 commit 740acc0

File tree

2 files changed

+174
-2
lines changed

2 files changed

+174
-2
lines changed

src/algebra/order/to_interval_mod.lean

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,3 +733,77 @@ lemma to_Ico_mod_zero_one (x : α) : to_Ico_mod (0 : α) zero_lt_one x = int.fra
733733
by simp [to_Ico_mod_eq_add_fract_mul]
734734

735735
end linear_ordered_field
736+
737+
/-! ### Lemmas about unions of translates of intervals -/
738+
section union
739+
740+
open set int
741+
742+
section linear_ordered_add_comm_group
743+
744+
variables {α : Type*} [linear_ordered_add_comm_group α] [archimedean α] (a : α) {b : α} (hb : 0 < b)
745+
include hb
746+
747+
lemma Union_Ioc_add_zsmul : (⋃ (n : ℤ), Ioc (a + n • b) (a + (n + 1) • b)) = univ :=
748+
begin
749+
refine eq_univ_iff_forall.mpr (λ x, mem_Union.mpr _),
750+
rcases sub_to_Ioc_div_zsmul_mem_Ioc a hb x with ⟨hl, hr⟩,
751+
refine ⟨to_Ioc_div a hb x, ⟨lt_sub_iff_add_lt.mp hl, _⟩⟩,
752+
rw [add_smul, one_smul, ←add_assoc],
753+
convert sub_le_iff_le_add.mp hr using 1, abel,
754+
end
755+
756+
lemma Union_Ico_add_zsmul : (⋃ (n : ℤ), Ico (a + n • b) (a + (n + 1) • b)) = univ :=
757+
begin
758+
refine eq_univ_iff_forall.mpr (λ x, mem_Union.mpr _),
759+
rcases sub_to_Ico_div_zsmul_mem_Ico a hb x with ⟨hl, hr⟩,
760+
refine ⟨to_Ico_div a hb x, ⟨le_sub_iff_add_le.mp hl, _⟩⟩,
761+
rw [add_smul, one_smul, ←add_assoc],
762+
convert sub_lt_iff_lt_add.mp hr using 1, abel,
763+
end
764+
765+
lemma Union_Icc_add_zsmul : (⋃ (n : ℤ), Icc (a + n • b) (a + (n + 1) • b)) = univ :=
766+
by simpa only [Union_Ioc_add_zsmul a hb, univ_subset_iff] using
767+
Union_mono (λ n : ℤ, (Ioc_subset_Icc_self : Ioc (a + n • b) (a + (n + 1) • b) ⊆ Icc _ _))
768+
769+
lemma Union_Ioc_zsmul : (⋃ (n : ℤ), Ioc (n • b) ((n + 1) • b)) = univ :=
770+
by simpa only [zero_add] using Union_Ioc_add_zsmul 0 hb
771+
772+
lemma Union_Ico_zsmul : (⋃ (n : ℤ), Ico (n • b) ((n + 1) • b)) = univ :=
773+
by simpa only [zero_add] using Union_Ico_add_zsmul 0 hb
774+
775+
lemma Union_Icc_zsmul : (⋃ (n : ℤ), Icc (n • b) ((n + 1) • b)) = univ :=
776+
by simpa only [zero_add] using Union_Icc_add_zsmul 0 hb
777+
778+
end linear_ordered_add_comm_group
779+
780+
section linear_ordered_ring
781+
782+
variables {α : Type*} [linear_ordered_ring α] [archimedean α] (a : α)
783+
784+
lemma Union_Ioc_add_int_cast : (⋃ (n : ℤ), Ioc (a + n) (a + n + 1)) = set.univ :=
785+
by simpa only [zsmul_one, int.cast_add, int.cast_one, ←add_assoc]
786+
using Union_Ioc_add_zsmul a zero_lt_one
787+
788+
lemma Union_Ico_add_int_cast : (⋃ (n : ℤ), Ico (a + n) (a + n + 1)) = set.univ :=
789+
by simpa only [zsmul_one, int.cast_add, int.cast_one, ←add_assoc]
790+
using Union_Ico_add_zsmul a zero_lt_one
791+
792+
lemma Union_Icc_add_int_cast : (⋃ (n : ℤ), Icc (a + n) (a + n + 1)) = set.univ :=
793+
by simpa only [zsmul_one, int.cast_add, int.cast_one, ←add_assoc]
794+
using Union_Icc_add_zsmul a (zero_lt_one' α)
795+
796+
variables (α)
797+
798+
lemma Union_Ioc_int_cast : (⋃ (n : ℤ), Ioc (n : α) (n + 1)) = set.univ :=
799+
by simpa only [zero_add] using Union_Ioc_add_int_cast (0 : α)
800+
801+
lemma Union_Ico_int_cast : (⋃ (n : ℤ), Ico (n : α) (n + 1)) = set.univ :=
802+
by simpa only [zero_add] using Union_Ico_add_int_cast (0 : α)
803+
804+
lemma Union_Icc_int_cast : (⋃ (n : ℤ), Icc (n : α) (n + 1)) = set.univ :=
805+
by simpa only [zero_add] using Union_Icc_add_int_cast (0 : α)
806+
807+
end linear_ordered_ring
808+
809+
end union

src/data/set/intervals/group.lean

Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Johannes Hölzl, Mario Carneiro, Patrick Massot, Yury Kudryashov, Rémy Degenne
55
-/
66
import data.set.intervals.basic
7+
import data.set.pairwise
78
import algebra.order.group.abs
9+
import algebra.group_power.lemmas
810

9-
/-! ### Lemmas about arithmetic operations and intervals.
11+
/-! ### Lemmas about arithmetic operations and intervals.
1012
1113
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
12-
> Any changes to this file require a corresponding PR to mathlib4.-/
14+
> Any changes to this file require a corresponding PR to mathlib4.
15+
-/
1316

1417
variables {α : Type*}
1518

@@ -98,4 +101,99 @@ end
98101

99102
end linear_ordered_add_comm_group
100103

104+
/-! ### Lemmas about disjointness of translates of intervals -/
105+
section pairwise_disjoint
106+
107+
section ordered_comm_group
108+
109+
variables [ordered_comm_group α] (a b : α)
110+
111+
@[to_additive]
112+
lemma pairwise_disjoint_Ioc_mul_zpow :
113+
pairwise (disjoint on λ n : ℤ, Ioc (a * b ^ n) (a * b ^ (n + 1))) :=
114+
begin
115+
simp_rw [function.on_fun, set.disjoint_iff],
116+
intros m n hmn x hx,
117+
apply hmn,
118+
have hb : 1 < b,
119+
{ have : a * b ^ m < a * b ^ (m + 1), from hx.1.1.trans_le hx.1.2,
120+
rwa [mul_lt_mul_iff_left, ←mul_one (b ^ m), zpow_add_one, mul_lt_mul_iff_left] at this },
121+
have i1 := hx.1.1.trans_le hx.2.2,
122+
have i2 := hx.2.1.trans_le hx.1.2,
123+
rw [mul_lt_mul_iff_left, zpow_lt_zpow_iff hb, int.lt_add_one_iff] at i1 i2,
124+
exact le_antisymm i1 i2
125+
end
126+
127+
@[to_additive]
128+
lemma pairwise_disjoint_Ico_mul_zpow :
129+
pairwise (disjoint on λ n : ℤ, Ico (a * b ^ n) (a * b ^ (n + 1))) :=
130+
begin
131+
simp_rw [function.on_fun, set.disjoint_iff],
132+
intros m n hmn x hx,
133+
apply hmn,
134+
have hb : 1 < b,
135+
{ have : a * b ^ m < a * b ^ (m + 1), from hx.1.1.trans_lt hx.1.2,
136+
rwa [mul_lt_mul_iff_left, ←mul_one (b ^ m), zpow_add_one, mul_lt_mul_iff_left] at this },
137+
have i1 := hx.1.1.trans_lt hx.2.2,
138+
have i2 := hx.2.1.trans_lt hx.1.2,
139+
rw [mul_lt_mul_iff_left, zpow_lt_zpow_iff hb, int.lt_add_one_iff] at i1 i2,
140+
exact le_antisymm i1 i2,
141+
end
142+
143+
@[to_additive]
144+
lemma pairwise_disjoint_Ioo_mul_zpow :
145+
pairwise (disjoint on λ n : ℤ, Ioo (a * b ^ n) (a * b ^ (n + 1))) :=
146+
λ m n hmn, (pairwise_disjoint_Ioc_mul_zpow a b hmn).mono Ioo_subset_Ioc_self Ioo_subset_Ioc_self
147+
148+
@[to_additive]
149+
lemma pairwise_disjoint_Ioc_zpow :
150+
pairwise (disjoint on λ n : ℤ, Ioc (b ^ n) (b ^ (n + 1))) :=
151+
by simpa only [one_mul] using pairwise_disjoint_Ioc_mul_zpow 1 b
152+
153+
@[to_additive]
154+
lemma pairwise_disjoint_Ico_zpow :
155+
pairwise (disjoint on λ n : ℤ, Ico (b ^ n) (b ^ (n + 1))) :=
156+
by simpa only [one_mul] using pairwise_disjoint_Ico_mul_zpow 1 b
157+
158+
@[to_additive]
159+
lemma pairwise_disjoint_Ioo_zpow :
160+
pairwise (disjoint on λ n : ℤ, Ioo (b ^ n) (b ^ (n + 1))) :=
161+
by simpa only [one_mul] using pairwise_disjoint_Ioo_mul_zpow 1 b
162+
163+
end ordered_comm_group
164+
165+
section ordered_ring
166+
167+
variables [ordered_ring α] (a : α)
168+
169+
lemma pairwise_disjoint_Ioc_add_int_cast :
170+
pairwise (disjoint on λ n : ℤ, Ioc (a + n) (a + n + 1)) :=
171+
by simpa only [zsmul_one, int.cast_add, int.cast_one, ←add_assoc]
172+
using pairwise_disjoint_Ioc_add_zsmul a (1 : α)
173+
174+
lemma pairwise_disjoint_Ico_add_int_cast :
175+
pairwise (disjoint on λ n : ℤ, Ico (a + n) (a + n + 1)) :=
176+
by simpa only [zsmul_one, int.cast_add, int.cast_one, ←add_assoc]
177+
using pairwise_disjoint_Ico_add_zsmul a (1 : α)
178+
179+
lemma pairwise_disjoint_Ioo_add_int_cast :
180+
pairwise (disjoint on λ n : ℤ, Ioo (a + n) (a + n + 1)) :=
181+
by simpa only [zsmul_one, int.cast_add, int.cast_one, ←add_assoc]
182+
using pairwise_disjoint_Ioo_add_zsmul a (1 : α)
183+
184+
variables (α)
185+
186+
lemma pairwise_disjoint_Ico_int_cast : pairwise (disjoint on λ n : ℤ, Ico (n : α) (n + 1)) :=
187+
by simpa only [zero_add] using pairwise_disjoint_Ico_add_int_cast (0 : α)
188+
189+
lemma pairwise_disjoint_Ioo_int_cast : pairwise (disjoint on λ n : ℤ, Ioo (n : α) (n + 1)) :=
190+
by simpa only [zero_add] using pairwise_disjoint_Ioo_add_int_cast (0 : α)
191+
192+
lemma pairwise_disjoint_Ioc_int_cast : pairwise (disjoint on λ n : ℤ, Ioc (n : α) (n + 1)) :=
193+
by simpa only [zero_add] using pairwise_disjoint_Ioc_add_int_cast (0 : α)
194+
195+
end ordered_ring
196+
197+
end pairwise_disjoint
198+
101199
end set

0 commit comments

Comments
 (0)