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

Commit dd13f00

Browse files
committed
feat(data/set/intervals/basic): 24 lemmas about membership of arithmetic operations (#6202)
1 parent 254c3ee commit dd13f00

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

src/data/set/intervals/basic.lean

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,70 @@ end
11531153

11541154
end linear_order
11551155

1156+
/-! ### Lemmas about membership of arithmetic operations -/
1157+
1158+
section ordered_comm_group
1159+
1160+
variables {α : Type*} [ordered_comm_group α] {a b c d : α}
1161+
1162+
/-! `inv_mem_Ixx_iff`, `sub_mem_Ixx_iff` -/
1163+
@[to_additive] lemma inv_mem_Icc_iff : a⁻¹ ∈ set.Icc c d ↔ a ∈ set.Icc (d⁻¹) (c⁻¹) :=
1164+
(and_comm _ _).trans $ (and_congr inv_le' le_inv')
1165+
@[to_additive] lemma inv_mem_Ico_iff : a⁻¹ ∈ set.Ico c d ↔ a ∈ set.Ioc (d⁻¹) (c⁻¹) :=
1166+
(and_comm _ _).trans $ (and_congr inv_lt' le_inv')
1167+
@[to_additive] lemma inv_mem_Ioc_iff : a⁻¹ ∈ set.Ioc c d ↔ a ∈ set.Ico (d⁻¹) (c⁻¹) :=
1168+
(and_comm _ _).trans $ (and_congr inv_le' lt_inv')
1169+
@[to_additive] lemma inv_mem_Ioo_iff : a⁻¹ ∈ set.Ioo c d ↔ a ∈ set.Ioo (d⁻¹) (c⁻¹) :=
1170+
(and_comm _ _).trans $ (and_congr inv_lt' lt_inv')
1171+
1172+
end ordered_comm_group
1173+
1174+
section ordered_add_comm_group
1175+
1176+
variables {α : Type*} [ordered_add_comm_group α] {a b c d : α}
1177+
1178+
/-! `add_mem_Ixx_iff_left` -/
1179+
lemma add_mem_Icc_iff_left : a + b ∈ set.Icc c d ↔ a ∈ set.Icc (c - b) (d - b) :=
1180+
(and_congr sub_le_iff_le_add le_sub_iff_add_le).symm
1181+
lemma add_mem_Ico_iff_left : a + b ∈ set.Ico c d ↔ a ∈ set.Ico (c - b) (d - b) :=
1182+
(and_congr sub_le_iff_le_add lt_sub_iff_add_lt).symm
1183+
lemma add_mem_Ioc_iff_left : a + b ∈ set.Ioc c d ↔ a ∈ set.Ioc (c - b) (d - b) :=
1184+
(and_congr sub_lt_iff_lt_add le_sub_iff_add_le).symm
1185+
lemma add_mem_Ioo_iff_left : a + b ∈ set.Ioo c d ↔ a ∈ set.Ioo (c - b) (d - b) :=
1186+
(and_congr sub_lt_iff_lt_add lt_sub_iff_add_lt).symm
1187+
1188+
/-! `add_mem_Ixx_iff_right` -/
1189+
lemma add_mem_Icc_iff_right : a + b ∈ set.Icc c d ↔ b ∈ set.Icc (c - a) (d - a) :=
1190+
(and_congr sub_le_iff_le_add' le_sub_iff_add_le').symm
1191+
lemma add_mem_Ico_iff_right : a + b ∈ set.Ico c d ↔ b ∈ set.Ico (c - a) (d - a) :=
1192+
(and_congr sub_le_iff_le_add' lt_sub_iff_add_lt').symm
1193+
lemma add_mem_Ioc_iff_right : a + b ∈ set.Ioc c d ↔ b ∈ set.Ioc (c - a) (d - a) :=
1194+
(and_congr sub_lt_iff_lt_add' le_sub_iff_add_le').symm
1195+
lemma add_mem_Ioo_iff_right : a + b ∈ set.Ioo c d ↔ b ∈ set.Ioo (c - a) (d - a) :=
1196+
(and_congr sub_lt_iff_lt_add' lt_sub_iff_add_lt').symm
1197+
1198+
/-! `sub_mem_Ixx_iff_left` -/
1199+
lemma sub_mem_Icc_iff_left : a - b ∈ set.Icc c d ↔ a ∈ set.Icc (c + b) (d + b) :=
1200+
(and_congr le_sub_iff_add_le sub_le_iff_le_add)
1201+
lemma sub_mem_Ico_iff_left : a - b ∈ set.Ico c d ↔ a ∈ set.Ico (c + b) (d + b) :=
1202+
(and_congr le_sub_iff_add_le sub_lt_iff_lt_add)
1203+
lemma sub_mem_Ioc_iff_left : a - b ∈ set.Ioc c d ↔ a ∈ set.Ioc (c + b) (d + b) :=
1204+
(and_congr lt_sub_iff_add_lt sub_le_iff_le_add)
1205+
lemma sub_mem_Ioo_iff_left : a - b ∈ set.Ioo c d ↔ a ∈ set.Ioo (c + b) (d + b) :=
1206+
(and_congr lt_sub_iff_add_lt sub_lt_iff_lt_add)
1207+
1208+
/-! `sub_mem_Ixx_iff_right` -/
1209+
lemma sub_mem_Icc_iff_right : a - b ∈ set.Icc c d ↔ b ∈ set.Icc (a - d) (a - c) :=
1210+
(and_comm _ _).trans $ (and_congr sub_le le_sub)
1211+
lemma sub_mem_Ico_iff_right : a - b ∈ set.Ico c d ↔ b ∈ set.Ioc (a - d) (a - c) :=
1212+
(and_comm _ _).trans $ (and_congr sub_lt le_sub)
1213+
lemma sub_mem_Ioc_iff_right : a - b ∈ set.Ioc c d ↔ b ∈ set.Ico (a - d) (a - c) :=
1214+
(and_comm _ _).trans $ (and_congr sub_le lt_sub)
1215+
lemma sub_mem_Ioo_iff_right : a - b ∈ set.Ioo c d ↔ b ∈ set.Ioo (a - d) (a - c) :=
1216+
(and_comm _ _).trans $ (and_congr sub_lt lt_sub)
1217+
1218+
end ordered_add_comm_group
1219+
11561220
section linear_ordered_add_comm_group
11571221

11581222
variables {α : Type u} [linear_ordered_add_comm_group α]

0 commit comments

Comments
 (0)