Lean library · module TopologyByExample.Spaces.FourteenRealSubsets
Fourteen distinct closure–complement sets in the real line
This file was written by Codex (OpenAI's AI model) working under the direction of David R. MacIver, who reviews it and is responsible for it.
Imports
theorem zero_not_mem_original
TopologyByExample.FourteenRealSubsets.zero_not_mem_original
Zero is missing from the original subset.
theorem zero_not_mem_original : (0 : ℝ) ∉ original
Proof
:= by
rintro (((⟨n, hn⟩ | hp) | hq) | ((h23 | h34) | h56))
· have h : 0 < reciprocal n := by unfold reciprocal; positivity
rw [hn] at h
exact lt_irrefl _ h
· norm_num at hp
· have h := hq.2.1; norm_num at h
· have h := h23.1; norm_num at h
· have h := h34.1; norm_num at h
· have h := h56.1; norm_num at h
theorem two_not_mem_original
TopologyByExample.FourteenRealSubsets.two_not_mem_original
Two is missing from the original subset.
theorem two_not_mem_original : (2 : ℝ) ∉ original
Proof
:= by
rintro (((⟨n, hn⟩ | hp) | hq) | ((h23 | h34) | h56))
· have h := reciprocal_le_one n
rw [hn] at h
norm_num at h
· norm_num at hp
· have h := hq.2.1; norm_num at h
· exact lt_irrefl _ h23.1
· have h := h34.1; norm_num at h
· have h := h56.1; norm_num at h
theorem seven_mem_original
TopologyByExample.FourteenRealSubsets.seven_mem_original
The included rational left endpoint is a useful distinguishing point.
theorem seven_mem_original : (7 : ℝ) ∈ original
Proof
:=
Or.inl (Or.inr ⟨⟨7, by norm_num⟩, by norm_num, by norm_num⟩)
theorem sevenHalf_mem_original
TopologyByExample.FourteenRealSubsets.sevenHalf_mem_original
An interior rational point distinguishes the final two open words.
theorem sevenHalf_mem_original : (15 / 2 : ℝ) ∈ original
Proof
:=
Or.inl (Or.inr ⟨⟨15 / 2, by norm_num⟩, by norm_num, by norm_num⟩)
definition witness
TopologyByExample.FourteenRealSubsets.witness
Five points separate the seven positive words.
def witness : Fin 5 → ℝ
| 0 => 0 | 1 => 2 | 2 => 3 | 3 => 7 | 4 => 15 / 2
definition pattern
TopologyByExample.FourteenRealSubsets.pattern
Their membership patterns.
def pattern (i : Fin 7) (j : Fin 5) : Bool
Definition
:=
match i with
| 0 => j == 3 || j == 4
| 1 => true
| 2 => false
| 3 => j == 1 || j == 2
| 4 => j == 2 || j == 4
| 5 => j != 0
| 6 => j == 2
theorem pattern_injective
TopologyByExample.FourteenRealSubsets.pattern_injective
The finite patterns are all different.
theorem pattern_injective : Function.Injective pattern
Proof
:= by decide
theorem original_witness
TopologyByExample.FourteenRealSubsets.original_witness
Membership in the original set at the five test points.
theorem original_witness (j : Fin 5) : witness j ∈ original ↔ pattern 0 j = true
Proof
:= by
fin_cases j <;> simp [witness, pattern, zero_not_mem_original, two_not_mem_original,
three_not_mem_original, seven_mem_original, sevenHalf_mem_original]
theorem positive_witness
TopologyByExample.FourteenRealSubsets.positive_witness
The patterns are the actual memberships in the positive words.
theorem positive_witness (i : Fin 7) (j : Fin 5) :
witness j ∈ positive original i ↔ pattern i j = true
Proof
:= by
fin_cases i
· exact original_witness j
· fin_cases j <;> norm_num [positive, closure_original, witness, pattern,
FortSpaces.harmonicSet]
· fin_cases j <;> norm_num [positive, interior_original, witness, pattern]
· fin_cases j <;> norm_num [positive, closure_interior_original, witness, pattern]
· fin_cases j <;> norm_num [positive, interior_closure_original, witness, pattern]
· fin_cases j <;> norm_num [positive, closure_interior_closure_original, witness, pattern]
· fin_cases j <;> norm_num [positive, interior_closure_interior_original, witness, pattern]
theorem positive_injective
TopologyByExample.FourteenRealSubsets.positive_injective
All seven positive words are distinct.
theorem positive_injective : Function.Injective (positive original)
Proof
:= by
intro i j h
apply pattern_injective
funext k
apply Bool.eq_iff_iff.mpr
rw [← positive_witness, ← positive_witness, h]
theorem original_nonneg
TopologyByExample.FourteenRealSubsets.original_nonneg
The original subset contains only nonnegative points.
theorem original_nonneg : original ⊆ Ici (0 : ℝ)
Proof
:= by
rintro x (((⟨n, rfl⟩ | hp) | hq) | ((h23 | h34) | h56))
· change 0 ≤ reciprocal n
unfold reciprocal
positivity
· have hx : x = 9 / 2 := hp
rw [hx]
norm_num
· have h := hq.2.1
change 0 ≤ x
linarith
· have h := h23.1
change 0 ≤ x
linarith
· have h := h34.1
change 0 ≤ x
linarith
· have h := h56.1
change 0 ≤ x
linarith
theorem positive_nonneg
TopologyByExample.FourteenRealSubsets.positive_nonneg
All seven positive words contain only nonnegative points.
theorem positive_nonneg (i : Fin 7) : positive original i ⊆ Ici (0 : ℝ)
Proof
:= by
have hc := closure_minimal original_nonneg isClosed_Ici
have hi := interior_subset.trans original_nonneg
have hci := closure_minimal hi isClosed_Ici
have hic := interior_subset.trans hc
fin_cases i
· exact original_nonneg
· exact hc
· exact hi
· exact hci
· exact hic
· exact closure_minimal hic isClosed_Ici
· exact interior_subset.trans hci
theorem negative_not_mem_positive
TopologyByExample.FourteenRealSubsets.negative_not_mem_positive
The negative test point is absent from every positive word.
theorem negative_not_mem_positive (i : Fin 7) : (-1 : ℝ) ∉ positive original i
Proof
:= by
intro h
have hn : (0 : ℝ) ≤ -1 := positive_nonneg i h
norm_num at hn
theorem word_injective
TopologyByExample.FourteenRealSubsets.word_injective
All fourteen closure–complement words are distinct.
theorem word_injective : Function.Injective (word original)
Proof
:= by
rintro ⟨i, b⟩ ⟨j, c⟩ h
cases b <;> cases c <;> simp only [word, Bool.false_eq_true, ↓reduceIte] at h
· exact Prod.ext (positive_injective h) rfl
· have hn : (-1 : ℝ) ∈ positive original i := by
rw [h]
exact negative_not_mem_positive j
exact (negative_not_mem_positive i hn).elim
· have hn : (-1 : ℝ) ∈ positive original j := by
rw [← h]
exact negative_not_mem_positive i
exact (negative_not_mem_positive j hn).elim
· exact Prod.ext (positive_injective (compl_inj_iff.mp h)) rfl
theorem card_reachable
TopologyByExample.FourteenRealSubsets.card_reachable
The exact number of sets obtained by closure and complement is fourteen.
theorem card_reachable : Nat.card {B : Set ℝ // Reachable original B} = 14
Proof
:= by
have he : {B : Set ℝ | Reachable original B} = range (word original) := by
ext B
exact reachable_iff original B
change Nat.card ↥{B : Set ℝ | Reachable original B} = 14
rw [he, ← Nat.card_congr (Equiv.ofInjective (word original) word_injective)]
norm_num
On this site: Theorem: A real subset with fourteen distinct closure–complement sets