|
1 | 1 | /- |
2 | 2 | Copyright (c) 2019 Alexander Bentkamp. All rights reserved. |
3 | 3 | Released under Apache 2.0 license as described in the file LICENSE. |
4 | | -Authors: Alexander Bentkamp, Yury Kudriashov, Yaël Dillies |
| 4 | +Authors: Alexander Bentkamp, Yury Kudryashov, Yaël Dillies |
5 | 5 | -/ |
6 | 6 | import algebra.order.invertible |
7 | 7 | import algebra.order.smul |
@@ -29,9 +29,10 @@ Should we rename `segment` and `open_segment` to `convex.Icc` and `convex.Ioo`? |
29 | 29 | define `clopen_segment`/`convex.Ico`/`convex.Ioc`? |
30 | 30 | -/ |
31 | 31 |
|
32 | | -variables {𝕜 E F : Type*} |
| 32 | +variables {𝕜 E F G ι : Type*} {π : ι → Type*} |
33 | 33 |
|
34 | | -open set |
| 34 | +open function set |
| 35 | +open_locale pointwise |
35 | 36 |
|
36 | 37 | section ordered_semiring |
37 | 38 | variables [ordered_semiring 𝕜] [add_comm_monoid E] |
@@ -137,7 +138,8 @@ end ordered_semiring |
137 | 138 | open_locale convex |
138 | 139 |
|
139 | 140 | section ordered_ring |
140 | | -variables (𝕜) [ordered_ring 𝕜] [add_comm_group E] [add_comm_group F] [module 𝕜 E] [module 𝕜 F] |
| 141 | +variables (𝕜) [ordered_ring 𝕜] [add_comm_group E] [add_comm_group F] [add_comm_group G] [module 𝕜 E] |
| 142 | + [module 𝕜 F] |
141 | 143 |
|
142 | 144 | section densely_ordered |
143 | 145 | variables [nontrivial 𝕜] [densely_ordered 𝕜] |
@@ -180,28 +182,29 @@ lemma open_segment_eq_image_line_map (x y : E) : |
180 | 182 | open_segment 𝕜 x y = affine_map.line_map x y '' Ioo (0 : 𝕜) 1 := |
181 | 183 | by { convert open_segment_eq_image 𝕜 x y, ext, exact affine_map.line_map_apply_module _ _ _ } |
182 | 184 |
|
183 | | -lemma segment_image (f : E →ₗ[𝕜] F) (a b : E) : f '' [a -[𝕜] b] = [f a -[𝕜] f b] := |
184 | | -set.ext (λ x, by simp_rw [segment_eq_image, mem_image, exists_exists_and_eq_and, map_add, map_smul]) |
| 185 | +@[simp] lemma image_segment (f : E →ᵃ[𝕜] F) (a b : E) : f '' [a -[𝕜] b] = [f a -[𝕜] f b] := |
| 186 | +set.ext $ λ x, by simp_rw [segment_eq_image_line_map, mem_image, exists_exists_and_eq_and, |
| 187 | + affine_map.apply_line_map] |
185 | 188 |
|
186 | | -@[simp] lemma open_segment_image (f : E →ₗ[𝕜] F) (a b : E) : |
| 189 | +@[simp] lemma image_open_segment (f : E →ᵃ[𝕜] F) (a b : E) : |
187 | 190 | f '' open_segment 𝕜 a b = open_segment 𝕜 (f a) (f b) := |
188 | | -set.ext (λ x, by simp_rw [open_segment_eq_image, mem_image, exists_exists_and_eq_and, map_add, |
189 | | - map_smul]) |
| 191 | +set.ext $ λ x, by simp_rw [open_segment_eq_image_line_map, mem_image, exists_exists_and_eq_and, |
| 192 | + affine_map.apply_line_map] |
190 | 193 |
|
191 | | -lemma mem_segment_translate (a : E) {x b c} : a + x ∈ [a + b -[𝕜] a + c] ↔ x ∈ [b -[𝕜] c] := |
192 | | -begin |
193 | | - rw [segment_eq_image', segment_eq_image'], |
194 | | - refine exists_congr (λ θ, and_congr iff.rfl _), |
195 | | - simp only [add_sub_add_left_eq_sub, add_assoc, add_right_inj], |
196 | | -end |
| 194 | +@[simp] lemma vadd_segment [add_torsor G E] [vadd_comm_class G E E] (a : G) (b c : E) : |
| 195 | + a +ᵥ [b -[𝕜] c] = [a +ᵥ b -[𝕜] a +ᵥ c] := |
| 196 | +image_segment 𝕜 ⟨_, linear_map.id, λ _ _, vadd_comm _ _ _⟩ b c |
| 197 | + |
| 198 | +@[simp] lemma vadd_open_segment [add_torsor G E] [vadd_comm_class G E E] (a : G) (b c : E) : |
| 199 | + a +ᵥ open_segment 𝕜 b c = open_segment 𝕜 (a +ᵥ b) (a +ᵥ c) := |
| 200 | +image_open_segment 𝕜 ⟨_, linear_map.id, λ _ _, vadd_comm _ _ _⟩ b c |
| 201 | + |
| 202 | +@[simp] lemma mem_segment_translate (a : E) {x b c} : a + x ∈ [a + b -[𝕜] a + c] ↔ x ∈ [b -[𝕜] c] := |
| 203 | +by simp_rw [←vadd_eq_add, ←vadd_segment, vadd_mem_vadd_set_iff] |
197 | 204 |
|
198 | 205 | @[simp] lemma mem_open_segment_translate (a : E) {x b c : E} : |
199 | 206 | a + x ∈ open_segment 𝕜 (a + b) (a + c) ↔ x ∈ open_segment 𝕜 b c := |
200 | | -begin |
201 | | - rw [open_segment_eq_image', open_segment_eq_image'], |
202 | | - refine exists_congr (λ θ, and_congr iff.rfl _), |
203 | | - simp only [add_sub_add_left_eq_sub, add_assoc, add_right_inj], |
204 | | -end |
| 207 | +by simp_rw [←vadd_eq_add, ←vadd_open_segment, vadd_mem_vadd_set_iff] |
205 | 208 |
|
206 | 209 | lemma segment_translate_preimage (a b c : E) : (λ x, a + x) ⁻¹' [a + b -[𝕜] a + c] = [b -[𝕜] c] := |
207 | 210 | set.ext $ λ x, mem_segment_translate 𝕜 a |
@@ -492,3 +495,95 @@ begin |
492 | 495 | end |
493 | 496 |
|
494 | 497 | end linear_ordered_field |
| 498 | + |
| 499 | +namespace prod |
| 500 | +variables [ordered_semiring 𝕜] [add_comm_monoid E] [add_comm_monoid F] [module 𝕜 E] [module 𝕜 F] |
| 501 | + |
| 502 | +lemma segment_subset (x y : E × F) : segment 𝕜 x y ⊆ segment 𝕜 x.1 y.1 ×ˢ segment 𝕜 x.2 y.2 := |
| 503 | +begin |
| 504 | + rintro z ⟨a, b, ha, hb, hab, hz⟩, |
| 505 | + exact ⟨⟨a, b, ha, hb, hab, congr_arg prod.fst hz⟩, a, b, ha, hb, hab, congr_arg prod.snd hz⟩, |
| 506 | +end |
| 507 | + |
| 508 | +lemma open_segment_subset (x y : E × F) : |
| 509 | + open_segment 𝕜 x y ⊆ open_segment 𝕜 x.1 y.1 ×ˢ open_segment 𝕜 x.2 y.2 := |
| 510 | +begin |
| 511 | + rintro z ⟨a, b, ha, hb, hab, hz⟩, |
| 512 | + exact ⟨⟨a, b, ha, hb, hab, congr_arg prod.fst hz⟩, a, b, ha, hb, hab, congr_arg prod.snd hz⟩, |
| 513 | +end |
| 514 | + |
| 515 | +lemma image_mk_segment_left (x₁ x₂ : E) (y : F) : |
| 516 | + (λ x, (x, y)) '' [x₁ -[𝕜] x₂] = [(x₁, y) -[𝕜] (x₂, y)] := |
| 517 | +begin |
| 518 | + ext ⟨x', y'⟩, |
| 519 | + simp_rw [set.mem_image, segment, set.mem_set_of, prod.smul_mk, prod.mk_add_mk, |
| 520 | + prod.mk.inj_iff, ←exists_and_distrib_right, @exists_comm E, exists_eq_left'], |
| 521 | + refine exists₅_congr (λ a b ha hb hab, _), |
| 522 | + rw convex.combo_self hab, |
| 523 | +end |
| 524 | + |
| 525 | +lemma image_mk_segment_right (x : E) (y₁ y₂ : F) : |
| 526 | + (λ y, (x, y)) '' [y₁ -[𝕜] y₂] = [(x, y₁) -[𝕜] (x, y₂)] := |
| 527 | +begin |
| 528 | + ext ⟨x', y'⟩, |
| 529 | + simp_rw [set.mem_image, segment, set.mem_set_of, prod.smul_mk, prod.mk_add_mk, |
| 530 | + prod.mk.inj_iff, ←exists_and_distrib_right, @exists_comm F, exists_eq_left'], |
| 531 | + refine exists₅_congr (λ a b ha hb hab, _), |
| 532 | + rw convex.combo_self hab, |
| 533 | +end |
| 534 | + |
| 535 | +lemma image_mk_open_segment_left (x₁ x₂ : E) (y : F) : |
| 536 | + (λ x, (x, y)) '' open_segment 𝕜 x₁ x₂ = open_segment 𝕜 (x₁, y) (x₂, y) := |
| 537 | +begin |
| 538 | + ext ⟨x', y'⟩, |
| 539 | + simp_rw [set.mem_image, open_segment, set.mem_set_of, prod.smul_mk, prod.mk_add_mk, |
| 540 | + prod.mk.inj_iff, ←exists_and_distrib_right, @exists_comm E, exists_eq_left'], |
| 541 | + refine exists₅_congr (λ a b ha hb hab, _), |
| 542 | + rw convex.combo_self hab, |
| 543 | +end |
| 544 | + |
| 545 | +@[simp] lemma image_mk_open_segment_right (x : E) (y₁ y₂ : F) : |
| 546 | + (λ y, (x, y)) '' open_segment 𝕜 y₁ y₂ = open_segment 𝕜 (x, y₁) (x, y₂) := |
| 547 | +begin |
| 548 | + ext ⟨x', y'⟩, |
| 549 | + simp_rw [set.mem_image, open_segment, set.mem_set_of, prod.smul_mk, prod.mk_add_mk, |
| 550 | + prod.mk.inj_iff, ←exists_and_distrib_right, @exists_comm F, exists_eq_left'], |
| 551 | + refine exists₅_congr (λ a b ha hb hab, _), |
| 552 | + rw convex.combo_self hab, |
| 553 | +end |
| 554 | + |
| 555 | +end prod |
| 556 | + |
| 557 | +namespace pi |
| 558 | +variables [ordered_semiring 𝕜] [Π i, add_comm_monoid (π i)] [Π i, module 𝕜 (π i)] {s : set ι} |
| 559 | + |
| 560 | +lemma segment_subset (x y : Π i, π i) : segment 𝕜 x y ⊆ s.pi (λ i, segment 𝕜 (x i) (y i)) := |
| 561 | +by { rintro z ⟨a, b, ha, hb, hab, hz⟩ i -, exact ⟨a, b, ha, hb, hab, congr_fun hz i⟩ } |
| 562 | + |
| 563 | +lemma open_segment_subset (x y : Π i, π i) : |
| 564 | + open_segment 𝕜 x y ⊆ s.pi (λ i, open_segment 𝕜 (x i) (y i)) := |
| 565 | +by { rintro z ⟨a, b, ha, hb, hab, hz⟩ i -, exact ⟨a, b, ha, hb, hab, congr_fun hz i⟩ } |
| 566 | + |
| 567 | +variables [decidable_eq ι] |
| 568 | + |
| 569 | +lemma image_update_segment (i : ι) (x₁ x₂ : π i) (y : Π i, π i) : |
| 570 | + update y i '' [x₁ -[𝕜] x₂] = [update y i x₁ -[𝕜] update y i x₂] := |
| 571 | +begin |
| 572 | + ext z, |
| 573 | + simp_rw [set.mem_image, segment, set.mem_set_of, ←update_smul, ←update_add, update_eq_iff, |
| 574 | + ←exists_and_distrib_right, @exists_comm (π i), exists_eq_left'], |
| 575 | + refine exists₅_congr (λ a b ha hb hab, _), |
| 576 | + rw convex.combo_self hab, |
| 577 | +end |
| 578 | + |
| 579 | +lemma image_update_open_segment (i : ι) (x₁ x₂ : π i) (y : Π i, π i) : |
| 580 | + update y i '' open_segment 𝕜 x₁ x₂ = open_segment 𝕜 (update y i x₁) (update y i x₂) := |
| 581 | +begin |
| 582 | + ext z, |
| 583 | + simp_rw [set.mem_image, open_segment, set.mem_set_of, ←update_smul, ←update_add, update_eq_iff, |
| 584 | + ←exists_and_distrib_right, @exists_comm (π i), exists_eq_left'], |
| 585 | + refine exists₅_congr (λ a b ha hb hab, _), |
| 586 | + rw convex.combo_self hab, |
| 587 | +end |
| 588 | + |
| 589 | +end pi |
0 commit comments