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

Commit 8e7028c

Browse files
committed
feat(topology/unit_interval): abstract out material about [0,1] (#7056)
Separates out some material about `[0,1]` from `topology/path_connected.lean`, and adds a very simple tactic. Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent c6b0636 commit 8e7028c

File tree

2 files changed

+89
-43
lines changed

2 files changed

+89
-43
lines changed

src/topology/path_connected.lean

Lines changed: 7 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright (c) 2020 Patrick Massot. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Patrick Massot
55
-/
6-
import topology.instances.real
6+
import topology.unit_interval
77
import topology.algebra.ordered.proj_Icc
88

99
/-!
@@ -58,47 +58,11 @@ on `(-∞, 0]` and to `y` on `[1, +∞)`.
5858
-/
5959

6060
noncomputable theory
61-
open_locale classical topological_space filter
62-
open filter set function
61+
open_locale classical topological_space filter unit_interval
62+
open filter set function unit_interval
6363

6464
variables {X : Type*} [topological_space X] {x y z : X} {ι : Type*}
6565

66-
/-! ### The unit interval -/
67-
68-
local notation `I` := Icc (0 : ℝ) 1
69-
70-
lemma Icc_zero_one_symm {t : ℝ} : t ∈ I ↔ 1 - t ∈ I :=
71-
begin
72-
rw [mem_Icc, mem_Icc],
73-
split ; intro ; split ; linarith
74-
end
75-
76-
instance I_has_zero : has_zero I := ⟨⟨0, by split ; norm_num⟩⟩
77-
78-
@[simp, norm_cast] lemma coe_I_zero : ((0 : I) : ℝ) = 0 := rfl
79-
80-
instance I_has_one : has_one I := ⟨⟨1, by split ; norm_num⟩⟩
81-
82-
@[simp, norm_cast] lemma coe_I_one : ((1 : I) : ℝ) = 1 := rfl
83-
84-
/-- Unit interval central symmetry. -/
85-
def I_symm : I → I := λ t, ⟨1 - t.val, Icc_zero_one_symm.mp t.property⟩
86-
87-
local notation ` := I_symm
88-
89-
@[simp] lemma I_symm_zero : σ 0 = 1 :=
90-
subtype.ext $ by simp [I_symm]
91-
92-
@[simp] lemma I_symm_one : σ 1 = 0 :=
93-
subtype.ext $ by simp [I_symm]
94-
95-
@[continuity]
96-
lemma continuous_I_symm : continuous σ :=
97-
by continuity!
98-
99-
instance : connected_space I :=
100-
subtype.connected_space ⟨nonempty_Icc.mpr zero_le_one, is_preconnected_Icc⟩
101-
10266
/-! ### Paths -/
10367

10468
/-- Continuous path connecting two points `x` and `y` in a topological space -/
@@ -162,9 +126,9 @@ by { ext, refl }
162126
range γ.symm = range γ :=
163127
begin
164128
ext x,
165-
simp only [ mem_range, path.symm, has_coe_to_fun.coe, coe_fn, I_symm, set_coe.exists, comp_app,
166-
subtype.coe_mk, subtype.val_eq_coe ],
167-
split; rintros ⟨y, hy, hxy⟩; refine ⟨1-y, Icc_zero_one_symm.mp hy, _⟩; convert hxy,
129+
simp only [mem_range, path.symm, has_coe_to_fun.coe, coe_fn, unit_interval.symm, set_coe.exists,
130+
comp_app, subtype.coe_mk, subtype.val_eq_coe],
131+
split; rintros ⟨y, hy, hxy⟩; refine ⟨1-y, mem_iff_one_sub_mem.mp hy, _⟩; convert hxy,
168132
simp
169133
end
170134

@@ -316,7 +280,7 @@ rfl
316280
lemma symm_continuous_family {X ι : Type*} [topological_space X] [topological_space ι]
317281
{a b : ι → X} (γ : Π (t : ι), path (a t) (b t)) (h : continuous ↿γ) :
318282
continuous ↿(λ t, (γ t).symm) :=
319-
h.comp (continuous_id.prod_map continuous_I_symm)
283+
h.comp (continuous_id.prod_map continuous_symm)
320284

321285
lemma continuous_uncurry_extend_of_continuous_family {X ι : Type*} [topological_space X]
322286
[topological_space ι] {a b : ι → X} (γ : Π (t : ι), path (a t) (b t)) (h : continuous ↿γ) :

src/topology/unit_interval.lean

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/-
2+
Copyright (c) 2020 Patrick Massot. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Patrick Massot
5+
-/
6+
import topology.instances.real
7+
8+
/-!
9+
# The unit interval, as a topological space
10+
11+
Use `open_locale unit_interval` to turn on the notation `I := set.Icc (0 : ℝ) (1 : ℝ)`.
12+
13+
We provide basic instances, as well as a custom tactic for discharging
14+
`0 ≤ x`, `0 ≤ 1 - x`, `x ≤ 1`, and `1 - x ≤ 1` when `x : I`.
15+
16+
-/
17+
18+
noncomputable theory
19+
open_locale classical topological_space filter
20+
open set
21+
22+
/-! ### The unit interval -/
23+
24+
/-- The unit interval `[0,1]` in ℝ. -/
25+
abbreviation unit_interval : set ℝ := set.Icc 0 1
26+
27+
localized "notation `I` := unit_interval" in unit_interval
28+
29+
namespace unit_interval
30+
31+
lemma mem_iff_one_sub_mem {t : ℝ} : t ∈ I ↔ 1 - t ∈ I :=
32+
begin
33+
rw [mem_Icc, mem_Icc],
34+
split ; intro ; split ; linarith
35+
end
36+
37+
instance has_zero : has_zero I := ⟨⟨0, by split ; norm_num⟩⟩
38+
39+
@[simp, norm_cast] lemma coe_zero : ((0 : I) : ℝ) = 0 := rfl
40+
41+
instance has_one : has_one I := ⟨⟨1, by split ; norm_num⟩⟩
42+
43+
@[simp, norm_cast] lemma coe_one : ((1 : I) : ℝ) = 1 := rfl
44+
45+
instance : nonempty I := ⟨0
46+
47+
/-- Unit interval central symmetry. -/
48+
def symm : I → I := λ t, ⟨1 - t.val, mem_iff_one_sub_mem.mp t.property⟩
49+
50+
localized "notation `σ` := unit_interval.symm" in unit_interval
51+
52+
@[simp] lemma symm_zero : σ 0 = 1 :=
53+
subtype.ext $ by simp [symm]
54+
55+
@[simp] lemma symm_one : σ 1 = 0 :=
56+
subtype.ext $ by simp [symm]
57+
58+
@[continuity]
59+
lemma continuous_symm : continuous σ :=
60+
by continuity!
61+
62+
instance : connected_space I :=
63+
subtype.connected_space ⟨nonempty_Icc.mpr zero_le_one, is_preconnected_Icc⟩
64+
65+
/-- Verify there is an instance for `compact_space I`. -/
66+
example : compact_space I := by apply_instance
67+
68+
lemma nonneg (x : I) : 0 ≤ (x : ℝ) := x.2.1
69+
lemma one_minus_nonneg (x : I) : 01 - (x : ℝ) := by simpa using x.2.2
70+
lemma le_one (x : I) : (x : ℝ) ≤ 1 := x.2.2
71+
lemma one_minus_le_one (x : I) : 1 - (x : ℝ) ≤ 1 := by simpa using x.2.1
72+
73+
end unit_interval
74+
75+
namespace tactic.interactive
76+
77+
/-- A tactic that solves `0 ≤ x`, `0 ≤ 1 - x`, `x ≤ 1`, and `1 - x ≤ 1` for `x : I`. -/
78+
meta def unit_interval : tactic unit :=
79+
`[apply unit_interval.nonneg] <|> `[apply unit_interval.one_minus_nonneg] <|>
80+
`[apply unit_interval.le_one] <|> `[apply unit_interval.one_minus_le_one]
81+
82+
end tactic.interactive

0 commit comments

Comments
 (0)