Lean library · module TopologyByExample.Spaces.ArensPlane

The Arens plane topology

Source file

In this file we define TopologyByExample.ArensPlane, the plane ℝ × ℝ with a topology from which the Arens square and its variants are cut out as subspaces. The points fall into four kinds, by their coordinates x and y:

  • a point with y = 0 and x < 1/2 (a left corner) has the basic neighbourhoods consisting of itself and the points with x < 1/4 and |y| < ε;
  • a point with y = 0 and 1/2 ≤ x (a right corner) has the basic neighbourhoods consisting of itself and the points with 3/4 < x and |y| < ε;
  • a point with y ≠ 0 and x = 1/2 (a middle point) has the horizontal strips 1/4 < x < 3/4, |y - y₀| < ε (off the axis) as basic neighbourhoods;
  • every other point (an ordinary point) has its Euclidean neighbourhoods, off the axis and off the line x = 1/2.

The plane itself is not Hausdorff (two left corners cannot be separated), but the subspaces we need meet the axis only in (0, 0) and (1, 0). A set A with the properties recorded in TopologyByExample.ArensPlane.IsArensSet (it contains the two corners, its other points lie in the open unit square, its ordinary points are dense there, and no ordinary point of A has the height of a middle point of A) gives a Hausdorff subspace that is semiregular, totally disconnected if A is countable, and so on.

Main definitions

Main statements

Tags

Arens square, semiregular, Hausdorff, counterexample

This file was written by Claude (Anthropic's AI model) working under the direction of David R. MacIver, who reviews it and is responsible for it.

Imports

definition ArensPlane

TopologyByExample.ArensPlane

The plane ℝ × ℝ, to be given the Arens topology.

def ArensPlane : Type
:= ℝ × ℝ

definition mk

TopologyByExample.ArensPlane.mk

The point of the Arens plane with the given coordinates.

def mk (a b : ℝ) : ArensPlane
:= (a, b)

definition toPlane

TopologyByExample.ArensPlane.toPlane

The point of the Euclidean plane underlying a point of the Arens plane.

def toPlane (z : ArensPlane) : ℝ × ℝ
:= z

definition x

TopologyByExample.ArensPlane.x

The horizontal coordinate.

def x (z : ArensPlane) : ℝ
:= (toPlane z).1

definition y

TopologyByExample.ArensPlane.y

The vertical coordinate, the height.

def y (z : ArensPlane) : ℝ
:= (toPlane z).2

theorem x_mk

TopologyByExample.ArensPlane.x_mk

@[simp] theorem x_mk (a b : ℝ) : (mk a b).x = a
Proof
:= rfl

theorem y_mk

TopologyByExample.ArensPlane.y_mk

@[simp] theorem y_mk (a b : ℝ) : (mk a b).y = b
Proof
:= rfl

theorem ext

TopologyByExample.ArensPlane.ext

Two points of the Arens plane with the same coordinates are equal.

theorem ext {z w : ArensPlane} (hx : z.x = w.x) (hy : z.y = w.y) : z = w
Proof
:=
  Prod.ext (α := ℝ) (β := ℝ) hx hy

theorem ext_iff

TopologyByExample.ArensPlane.ext_iff

Two points of the Arens plane are equal if and only if their coordinates are.

theorem ext_iff {z w : ArensPlane} : z = w ↔ z.x = w.x ∧ z.y = w.y
Proof
:=
  ⟨fun h ↦ h ▸ ⟨rfl, rfl⟩, fun h ↦ ext h.1 h.2⟩

definition basic

TopologyByExample.ArensPlane.basic

The basic neighbourhood of radius ε of a point, according to its kind.

noncomputable def basic (z : ArensPlane) (ε : ℝ) : Set ArensPlane
Definition
:=
  if z.y = 0 then
    if z.x < 1 / 2 then insert z {q | q.x < 1 / 4 ∧ |q.y| < ε}
    else insert z {q | 3 / 4 < q.x ∧ |q.y| < ε}
  else if z.x = 1 / 2 then {q | 1 / 4 < q.x ∧ q.x < 3 / 4 ∧ q.y ≠ 0 ∧ |q.y - z.y| < ε}
  else {q | |q.x - z.x| < ε ∧ |q.y - z.y| < ε ∧ q.y ≠ 0 ∧ q.x ≠ 1 / 2}

theorem basic_left

TopologyByExample.ArensPlane.basic_left

The basic neighbourhoods of a left corner.

theorem basic_left {z : ArensPlane} (h0 : z.y = 0) (h : z.x < 1 / 2) (ε : ℝ) :
    basic z ε = insert z {q | q.x < 1 / 4 ∧ |q.y| < ε}
Proof
:= by
  simp only [basic, h0, h, ↓reduceIte]

theorem basic_right

TopologyByExample.ArensPlane.basic_right

The basic neighbourhoods of a right corner.

theorem basic_right {z : ArensPlane} (h0 : z.y = 0) (h : ¬z.x < 1 / 2) (ε : ℝ) :
    basic z ε = insert z {q | 3 / 4 < q.x ∧ |q.y| < ε}
Proof
:= by
  simp only [basic, h0, h, ↓reduceIte]

theorem basic_mid

TopologyByExample.ArensPlane.basic_mid

The basic neighbourhoods of a middle point.

theorem basic_mid {z : ArensPlane} (h0 : z.y ≠ 0) (h : z.x = 1 / 2) (ε : ℝ) :
    basic z ε = {q | 1 / 4 < q.x ∧ q.x < 3 / 4 ∧ q.y ≠ 0 ∧ |q.y - z.y| < ε}
Proof
:= by
  simp only [basic, h0, h, ↓reduceIte]

theorem basic_ord

TopologyByExample.ArensPlane.basic_ord

The basic neighbourhoods of an ordinary point.

theorem basic_ord {z : ArensPlane} (h0 : z.y ≠ 0) (h : z.x ≠ 1 / 2) (ε : ℝ) :
    basic z ε = {q | |q.x - z.x| < ε ∧ |q.y - z.y| < ε ∧ q.y ≠ 0 ∧ q.x ≠ 1 / 2}
Proof
:= by
  simp only [basic, h0, h, ↓reduceIte]

theorem mem_basic_self

TopologyByExample.ArensPlane.mem_basic_self

A point lies in each of its basic neighbourhoods of positive radius.

theorem mem_basic_self (z : ArensPlane) {ε : ℝ} (hε : 0 < ε) : z ∈ basic z ε
Proof
:= by
  by_cases h0 : z.y = 0
  · by_cases h : z.x < 1 / 2
    · rw [basic_left h0 h]; exact mem_insert _ _
    · rw [basic_right h0 h]; exact mem_insert _ _
  · by_cases h : z.x = 1 / 2
    · rw [basic_mid h0 h]; exact ⟨by rw [h]; norm_num, by rw [h]; norm_num, h0, by simpa⟩
    · rw [basic_ord h0 h]; exact ⟨by simpa, by simpa, h0, h⟩

theorem basic_mono

TopologyByExample.ArensPlane.basic_mono

The basic neighbourhoods shrink with the radius.

theorem basic_mono (z : ArensPlane) {δ ε : ℝ} (h : δ ≤ ε) : basic z δ ⊆ basic z ε
Proof
:= by
  by_cases h0 : z.y = 0
  · by_cases hx : z.x < 1 / 2
    · rw [basic_left h0 hx, basic_left h0 hx]
      exact insert_subset_insert fun q hq ↦ ⟨hq.1, hq.2.trans_le h⟩
    · rw [basic_right h0 hx, basic_right h0 hx]
      exact insert_subset_insert fun q hq ↦ ⟨hq.1, hq.2.trans_le h⟩
  · by_cases hx : z.x = 1 / 2
    · rw [basic_mid h0 hx, basic_mid h0 hx]
      exact fun q hq ↦ ⟨hq.1, hq.2.1, hq.2.2.1, hq.2.2.2.trans_le h⟩
    · rw [basic_ord h0 hx, basic_ord h0 hx]
      exact fun q hq ↦ ⟨hq.1.trans_le h, hq.2.1.trans_le h, hq.2.2⟩

theorem exists_basic_subset

TopologyByExample.ArensPlane.exists_basic_subset

Every point of a basic neighbourhood of positive radius has a basic neighbourhood inside it.

theorem exists_basic_subset {z : ArensPlane} {ε : ℝ} (hε : 0 < ε) {q : ArensPlane}
    (hq : q ∈ basic z ε) : ∃ δ > 0, basic q δ ⊆ basic z ε
Proof
:= by
  -- The case of an ordinary point `q` lying in an open box inside the neighbourhood.
  have hord : ∀ (T : Set ArensPlane) (a b c d : ℝ), q.y ≠ 0 → q.x ≠ 1 / 2 → a < q.x → q.x < b →
      c < q.y → q.y < d →
      ({r : ArensPlane | a < r.x ∧ r.x < b ∧ c < r.y ∧ r.y < d ∧ r.y ≠ 0 ∧ r.x ≠ 1 / 2} ⊆ T) →
      ∃ δ > 0, basic q δ ⊆ T := by
    intro T a b c d hq0 hqx ha hb hc hd hsub
    refine ⟨min (min (q.x - a) (b - q.x)) (min (q.y - c) (d - q.y)), by
      simp only [lt_min_iff]; exact ⟨⟨by linarith, by linarith⟩, by linarith, by linarith⟩,
      fun r hr ↦ hsub ?_⟩
    rw [basic_ord hq0 hqx] at hr
    obtain ⟨h1, h2, h3, h4⟩ := hr
    simp only [lt_min_iff, abs_lt] at h1 h2
    exact ⟨by linarith, by linarith, by linarith, by linarith, h3, h4⟩
  by_cases h0 : z.y = 0
  · by_cases hx : z.x < 1 / 2
    · rw [basic_left h0 hx] at hq ⊢
      rcases hq with rfl | ⟨hq1, hq2⟩
      · exact ⟨ε, hε, (basic_left h0 hx ε).subset⟩
      by_cases hq0 : q.y = 0
      · refine ⟨ε, hε, ?_⟩
        rw [basic_left hq0 (by linarith)]
        exact insert_subset (.inr ⟨hq1, hq2⟩) (subset_insert _ _)
      · rw [abs_lt] at hq2
        refine hord _ (q.x - 1) (1 / 4) (-ε) ε hq0 (by intro h; linarith) (by linarith) hq1
          hq2.1 hq2.2 fun r hr ↦ .inr ⟨hr.2.1, abs_lt.2 ⟨hr.2.2.1, hr.2.2.2.1⟩⟩
    · rw [basic_right h0 hx] at hq ⊢
      rcases hq with rfl | ⟨hq1, hq2⟩
      · exact ⟨ε, hε, (basic_right h0 hx ε).subset⟩
      by_cases hq0 : q.y = 0
      · refine ⟨ε, hε, ?_⟩
        rw [basic_right hq0 (by linarith)]
        exact insert_subset (.inr ⟨hq1, hq2⟩) (subset_insert _ _)
      · rw [abs_lt] at hq2
        refine hord _ (3 / 4) (q.x + 1) (-ε) ε hq0 (by intro h; linarith) hq1 (by linarith)
          hq2.1 hq2.2 fun r hr ↦ .inr ⟨hr.1, abs_lt.2 ⟨hr.2.2.1, hr.2.2.2.1⟩⟩
  · by_cases hx : z.x = 1 / 2
    · rw [basic_mid h0 hx] at hq ⊢
      obtain ⟨hq1, hq2, hq0, hq3⟩ := hq
      by_cases hqx : q.x = 1 / 2
      · refine ⟨ε - |q.y - z.y|, by linarith, fun r hr ↦ ?_⟩
        rw [basic_mid hq0 hqx] at hr
        obtain ⟨hr1, hr2, hr0, hr3⟩ := hr
        refine ⟨hr1, hr2, hr0, ?_⟩
        calc |r.y - z.y| = |(r.y - q.y) + (q.y - z.y)| := by ring_nf
          _ ≤ |r.y - q.y| + |q.y - z.y| := abs_add_le _ _
          _ < ε := by linarith
      · rw [abs_lt] at hq3
        exact hord _ (1 / 4) (3 / 4) (z.y - ε) (z.y + ε) hq0 hqx hq1 hq2 (by linarith)
          (by linarith) fun r hr ↦
            ⟨hr.1, hr.2.1, hr.2.2.2.2.1,
              abs_lt.2 ⟨by linarith [hr.2.2.1], by linarith [hr.2.2.2.1]⟩⟩
    · rw [basic_ord h0 hx] at hq ⊢
      obtain ⟨hq1, hq2, hq0, hqx⟩ := hq
      rw [abs_lt] at hq1 hq2
      exact hord _ (z.x - ε) (z.x + ε) (z.y - ε) (z.y + ε) hq0 hqx (by linarith) (by linarith)
        (by linarith) (by linarith) fun r hr ↦
          ⟨abs_lt.2 ⟨by linarith [hr.1], by linarith [hr.2.1]⟩,
            abs_lt.2 ⟨by linarith [hr.2.2.1], by linarith [hr.2.2.2.1]⟩, hr.2.2.2.2⟩

instance

The Arens topology: a set is open if it contains a basic neighbourhood of each of its points.

instance : TopologicalSpace ArensPlane
Proof
where
  IsOpen U := ∀ z ∈ U, ∃ ε > 0, basic z ε ⊆ U
  isOpen_univ _ _ := ⟨1, one_pos, subset_univ _⟩
  isOpen_inter s t hs ht z hz := by
    obtain ⟨ε, hε, h⟩ := hs z hz.1
    obtain ⟨δ, hδ, h'⟩ := ht z hz.2
    exact ⟨min ε δ, lt_min hε hδ, subset_inter ((basic_mono z (min_le_left _ _)).trans h)
      ((basic_mono z (min_le_right _ _)).trans h')⟩
  isOpen_sUnion S hS := by
    rintro z ⟨t, ht, hz⟩
    obtain ⟨ε, hε, h⟩ := hS t ht z hz
    exact ⟨ε, hε, h.trans (subset_sUnion_of_mem ht)⟩

theorem isOpen_iff

TopologyByExample.ArensPlane.isOpen_iff

The open sets of the Arens plane, by definition.

theorem isOpen_iff {U : Set ArensPlane} : IsOpen U ↔ ∀ z ∈ U, ∃ ε > 0, basic z ε ⊆ U
Proof
:=
  Iff.rfl

theorem isOpen_basic

TopologyByExample.ArensPlane.isOpen_basic

The basic neighbourhoods of positive radius are open.

theorem isOpen_basic (z : ArensPlane) {ε : ℝ} (hε : 0 < ε) : IsOpen (basic z ε)
Proof
:=
  fun _ hq ↦ exists_basic_subset hε hq

theorem hasBasis_nhds

TopologyByExample.ArensPlane.hasBasis_nhds

The basic neighbourhoods of positive radius form a base of neighbourhoods of each point.

theorem hasBasis_nhds (z : ArensPlane) : (𝓝 z).HasBasis (fun ε : ℝ ↦ 0 < ε) (basic z)
Proof
:= by
  refine ⟨fun t ↦ ⟨fun ht ↦ ?_, fun ⟨ε, hε, h⟩ ↦
    mem_of_superset ((isOpen_basic z hε).mem_nhds (mem_basic_self z hε)) h⟩⟩
  obtain ⟨V, hVt, hV, hzV⟩ := mem_nhds_iff.1 ht
  obtain ⟨ε, hε, h⟩ := hV z hzV
  exact ⟨ε, hε, h.trans hVt⟩

theorem hasBasis_nhds_nat

TopologyByExample.ArensPlane.hasBasis_nhds_nat

The basic neighbourhoods of radius 1 / (n + 1) form a base of neighbourhoods of each point.

theorem hasBasis_nhds_nat (z : ArensPlane) :
    (𝓝 z).HasBasis (fun _ : ℕ ↦ True) fun n ↦ basic z (1 / (n + 1))
Proof
:=
  (hasBasis_nhds z).to_hasBasis
    (fun _ hε ↦ let ⟨n, hn⟩ := exists_nat_one_div_lt hε; ⟨n, trivial, basic_mono z hn.le⟩)
    fun n _ ↦ ⟨1 / (n + 1), Nat.one_div_pos_of_nat, subset_rfl⟩

instance

The Arens plane is first countable.

instance : FirstCountableTopology ArensPlane
Proof
:=
  ⟨fun z ↦ (hasBasis_nhds_nat z).isCountablyGenerated⟩

theorem continuous_y

TopologyByExample.ArensPlane.continuous_y

The height is continuous on the Arens plane: every basic neighbourhood of radius ε lies within ε of the height of its centre.

theorem continuous_y : Continuous y
Proof
:= by
  refine continuous_iff_continuousAt.2 fun z ↦
    ((hasBasis_nhds z).tendsto_iff Metric.nhds_basis_ball).2 fun ε hε ↦ ⟨ε, hε, fun q hq ↦ ?_⟩
  rw [Metric.mem_ball, Real.dist_eq]
  by_cases h0 : z.y = 0
  · by_cases hx : z.x < 1 / 2
    · rw [basic_left h0 hx] at hq
      rcases hq with rfl | ⟨-, hq⟩
      · simpa
      · simpa [h0] using hq
    · rw [basic_right h0 hx] at hq
      rcases hq with rfl | ⟨-, hq⟩
      · simpa
      · simpa [h0] using hq
  · by_cases hx : z.x = 1 / 2
    · rw [basic_mid h0 hx] at hq
      exact hq.2.2.2
    · rw [basic_ord h0 hx] at hq
      exact hq.2.1

theorem continuousAt_x

TopologyByExample.ArensPlane.continuousAt_x

At an ordinary point the horizontal coordinate is continuous.

theorem continuousAt_x {z : ArensPlane} (h0 : z.y ≠ 0) (hx : z.x ≠ 1 / 2) : ContinuousAt x z
Proof
:=
  ((hasBasis_nhds z).tendsto_iff Metric.nhds_basis_ball).2 fun ε hε ↦ ⟨ε, hε, fun q hq ↦ by
    rw [basic_ord h0 hx] at hq
    rw [Metric.mem_ball, Real.dist_eq]
    exact hq.1⟩

Subspaces

structure IsArensSet

TopologyByExample.ArensPlane.IsArensSet

The hypotheses on a subset A of the Arens plane under which the subspace A behaves like the Arens square: it contains the corners (0, 0) and (1, 0), its other points lie in the open unit square, its points off the line x = 1/2 are dense in the open unit square, and no point of A off the line x = 1/2 has the height of a point of A on it.

structure IsArensSet (A : Set ArensPlane) : Prop where
  /-- The left corner `(0, 0)` is a point of `A`. -/
  left_mem : mk 0 0 ∈ A
  /-- The right corner `(1, 0)` is a point of `A`. -/
  right_mem : mk 1 0 ∈ A
  /-- The other points of `A` lie in the open unit square. -/
  mem : ∀ z ∈ A, z = mk 0 0 ∨ z = mk 1 0 ∨ (0 < z.x ∧ z.x < 1 ∧ 0 < z.y ∧ z.y < 1)
  /-- Every open box in the unit square contains a point of `A` off the line `x = 1/2`. -/
  dense : ∀ a b c d : ℝ, 0 ≤ a → a < b → b ≤ 1 → 0 ≤ c → c < d → d ≤ 1 →
    ∃ z ∈ A, a < z.x ∧ z.x < b ∧ c < z.y ∧ z.y < d ∧ z.x ≠ 1 / 2
  /-- A point of `A` off the line `x = 1/2` and a point of `A` on it have different heights. -/
  y_ne : ∀ z ∈ A, ∀ w ∈ A, z.x ≠ 1 / 2 → w.x = 1 / 2 → z.y ≠ w.y
variable {A : Set ArensPlane}

theorem hasBasis_nhds_sub

TopologyByExample.ArensPlane.IsArensSet.hasBasis_nhds_sub

The basic neighbourhoods, pulled back to a subspace, form neighbourhood bases.

theorem hasBasis_nhds_sub (z : A) :
    (𝓝 z).HasBasis (fun ε : ℝ ↦ 0 < ε) fun ε ↦ Subtype.val ⁻¹' basic z ε
Proof
:= by
  rw [nhds_subtype]
  exact (hasBasis_nhds z.val).comap _

theorem continuous_y_sub

TopologyByExample.ArensPlane.IsArensSet.continuous_y_sub

The height is continuous on a subspace.

theorem continuous_y_sub : Continuous fun z : A ↦ z.val.y
Proof
:=
  continuous_y.comp continuous_subtypeVal
variable (hA : IsArensSet A)
include hA

theorem exists_pick

TopologyByExample.ArensPlane.IsArensSet.exists_pick

A box in the unit square contains a point of A off the axis and off the line x = 1/2.

theorem exists_pick {a b c d : ℝ} (ha : 0 ≤ a) (hab : a < b) (hb : b ≤ 1) (hc : 0 ≤ c)
    (hcd : c < d) (hd : d ≤ 1) :
    ∃ u : A, a < u.val.x ∧ u.val.x < b ∧ c < u.val.y ∧ u.val.y < d ∧ u.val.x ≠ 1 / 2 ∧
      u.val.y ≠ 0
Proof
:= by
  obtain ⟨u, hu, h1, h2, h3, h4, h5⟩ := hA.dense a b c d ha hab hb hc hcd hd
  exact ⟨⟨u, hu⟩, h1, h2, h3, h4, h5, by intro h; simp only [h] at h3; linarith⟩

theorem isOpen_x_lt

TopologyByExample.ArensPlane.IsArensSet.isOpen_x_lt

For 1/4 ≤ t ≤ 1/2 or 3/4 ≤ t ≤ 1, the points of A with x < t form an open set.

theorem isOpen_x_lt {t : ℝ} (h1 : 1 / 4 ≤ t) (h2 : t ≤ 1 / 2 ∨ 3 / 4 ≤ t) (h3 : t ≤ 1) :
    IsOpen {z : A | z.val.x < t}
Proof
:= by
  refine isOpen_iff_mem_nhds.2 fun z hz ↦ (hasBasis_nhds_sub z).mem_iff.2 ?_
  simp only [mem_ofPred_eq] at hz
  rcases hA.mem z.val z.property with h | h | ⟨hx0, hx1, hy0, hy1⟩
  · refine ⟨1, one_pos, fun r hr ↦ ?_⟩
    rw [h, basic_left (by simp) (by simp)] at hr
    rcases hr with hr | hr
    · simp only [mem_ofPred_eq, hr, x_mk]; linarith
    · exact hr.1.trans_le h1
  · simp [h] at hz; linarith
  · by_cases hx : z.val.x = 1 / 2
    · refine ⟨1, one_pos, fun r hr ↦ ?_⟩
      rw [mem_preimage, basic_mid hy0.ne' hx] at hr
      rcases h2 with h2 | h2
      · linarith
      · exact hr.2.1.trans_le h2
    · refine ⟨t - z.val.x, by linarith, fun r hr ↦ ?_⟩
      rw [mem_preimage, basic_ord hy0.ne' hx] at hr
      have := (abs_lt.1 hr.1).2
      simp only [mem_ofPred_eq]; linarith

theorem isOpen_lt_x

TopologyByExample.ArensPlane.IsArensSet.isOpen_lt_x

For 0 ≤ t ≤ 1/4 or 1/2 ≤ t ≤ 3/4, the points of A with t < x form an open set.

theorem isOpen_lt_x {t : ℝ} (h1 : t ≤ 3 / 4) (h2 : 1 / 2 ≤ t ∨ t ≤ 1 / 4) (h3 : 0 ≤ t) :
    IsOpen {z : A | t < z.val.x}
Proof
:= by
  refine isOpen_iff_mem_nhds.2 fun z hz ↦ (hasBasis_nhds_sub z).mem_iff.2 ?_
  simp only [mem_ofPred_eq] at hz
  rcases hA.mem z.val z.property with h | h | ⟨hx0, hx1, hy0, hy1⟩
  · simp [h] at hz; linarith
  · refine ⟨1, one_pos, fun r hr ↦ ?_⟩
    rw [h, basic_right (by simp) (by simp; norm_num)] at hr
    rcases hr with hr | hr
    · simp only [mem_ofPred_eq, hr, x_mk]; linarith
    · exact h1.trans_lt hr.1
  · by_cases hx : z.val.x = 1 / 2
    · refine ⟨1, one_pos, fun r hr ↦ ?_⟩
      rw [mem_preimage, basic_mid hy0.ne' hx] at hr
      rcases h2 with h2 | h2
      · rw [hx] at hz; linarith
      · exact h2.trans_lt hr.1
    · refine ⟨z.val.x - t, by linarith, fun r hr ↦ ?_⟩
      rw [mem_preimage, basic_ord hy0.ne' hx] at hr
      have := (abs_lt.1 hr.1).1
      simp only [mem_ofPred_eq]; linarith

theorem t2Space

TopologyByExample.ArensPlane.IsArensSet.t2Space

The subspace is Hausdorff. Points of different heights are separated by the height; the two corners by the sets x < 1/2 and 1/2 < x; two points off the axis at the same height are both off the line x = 1/2, and are separated by basic neighbourhoods.

theorem t2Space : T2Space A
Proof
:= by
  refine ⟨fun z w hzw ↦ ?_⟩
  by_cases hy : z.val.y = w.val.y
  · have hx : z.val.x ≠ w.val.x := fun hx ↦ hzw (Subtype.ext (ext hx hy))
    -- Points on opposite sides of the line `x = 1/2`, off it.
    have hside : ∀ z w : A, z.val.x < 1 / 2 → 1 / 2 < w.val.x → ∃ u v : Set A, IsOpen u ∧ IsOpen v ∧
        z ∈ u ∧ w ∈ v ∧ Disjoint u v := fun z w hz hw ↦
      ⟨_, _, hA.isOpen_x_lt (t := 1 / 2) (by norm_num) (.inl le_rfl) (by norm_num),
        hA.isOpen_lt_x (t := 1 / 2) (by norm_num) (.inl le_rfl) (by norm_num), hz, hw,
        disjoint_left.2 fun q hq hq' ↦ by simp only [mem_ofPred_eq] at hq hq'; linarith⟩
    by_cases h0 : z.val.y = 0
    · have hz := hA.mem z.val z.property
      have hw := hA.mem w.val w.property
      have hw0 : w.val.y = 0 := hy ▸ h0
      rcases hz with hz | hz | hz
      · rcases hw with hw | hw | hw
        · exact absurd (hz.trans hw.symm) (fun h ↦ hzw (Subtype.ext h))
        · exact hside z w (by norm_num [hz]) (by norm_num [hw])
        · linarith [hw.2.2.1]
      · rcases hw with hw | hw | hw
        · obtain ⟨u, v, hu, hv, hzu, hwv, huv⟩ := hside w z (by norm_num [hw]) (by norm_num [hz])
          exact ⟨v, u, hv, hu, hwv, hzu, huv.symm⟩
        · exact absurd (hz.trans hw.symm) (fun h ↦ hzw (Subtype.ext h))
        · linarith [hw.2.2.1]
      · linarith [hz.2.2.1]
    · have hzx : z.val.x ≠ 1 / 2 := by
        intro hzx
        by_cases hwx : w.val.x = 1 / 2
        · exact hx (hzx.trans hwx.symm)
        · exact hA.y_ne w.val w.property z.val z.property hwx hzx hy.symm
      have hwx : w.val.x ≠ 1 / 2 := fun hwx ↦ hA.y_ne z.val z.property w.val w.property hzx hwx hy
      have hw0 : w.val.y ≠ 0 := hy ▸ h0
      have hr : 0 < |z.val.x - w.val.x| / 2 := half_pos (abs_pos.2 (sub_ne_zero.2 hx))
      refine ⟨_, _, (isOpen_basic z.val hr).preimage continuous_subtypeVal,
        (isOpen_basic w.val hr).preimage continuous_subtypeVal, mem_basic_self z.val hr,
        mem_basic_self w.val hr, disjoint_left.2 fun q hq hq' ↦ ?_⟩
      rw [mem_preimage, basic_ord h0 hzx] at hq
      rw [mem_preimage, basic_ord hw0 hwx] at hq'
      have := abs_sub_le z.val.x q.val.x w.val.x
      rw [abs_sub_comm z.val.x q.val.x] at this
      linarith [hq.1, hq'.1]
  · obtain ⟨u, v, hu, hv, hzu, hwv, huv⟩ := t2_separation hy
    exact ⟨_, _, hu.preimage continuous_y_sub, hv.preimage continuous_y_sub, hzu, hwv,
      huv.preimage _⟩

theorem totallyDisconnectedSpace

TopologyByExample.ArensPlane.IsArensSet.totallyDisconnectedSpace

A countable subspace is totally disconnected. A preconnected set has countably many heights, so only one; at height 0 it lies in the two corners, which x < 1/2 and 1/2 < x separate; at another height it contains no point on the line x = 1/2 unless it is that point, and otherwise the horizontal coordinate, continuous at its points, takes countably many values on it, so only one.

theorem totallyDisconnectedSpace (hc : A.Countable) : TotallyDisconnectedSpace A
Proof
:= by
  refine (totallyDisconnectedSpace_iff _).2 fun t _ ht z hz w hw ↦ ?_
  -- All points of `t` have the same height.
  have hyt : ∀ q ∈ t, q.val.y = z.val.y := by
    have hsub : (fun q : A ↦ q.val.y) '' t ⊆ y '' A := by
      rintro _ ⟨q, -, rfl⟩
      exact ⟨q.val, q.property, rfl⟩
    have := (hc.image y).isTotallyDisconnected _ hsub
      (ht.image _ continuous_y_sub.continuousOn)
    exact fun q hq ↦ this ⟨q, hq, rfl⟩ ⟨z, hz, rfl⟩
  by_contra hzw
  have hx : z.val.x ≠ w.val.x := fun hx ↦ hzw (Subtype.ext (ext hx (hyt w hw).symm))
  by_cases h0 : z.val.y = 0
  · -- Two distinct corners: separate them by `x < 1/2` and `1/2 < x`.
    have hcorner : ∀ q ∈ t, q.val = ArensPlane.mk 0 0 ∨ q.val = ArensPlane.mk 1 0 := by
      intro q hq
      rcases hA.mem q.val q.property with h | h | h
      · exact .inl h
      · exact .inr h
      · linarith [hyt q hq, h.2.2.1]
    have hside : ∀ q ∈ t, q.val.x < 1 / 2 ∨ 1 / 2 < q.val.x := by
      intro q hq
      rcases hcorner q hq with h | h
      · left; rw [h]; norm_num
      · right; rw [h]; norm_num
    have key : ∀ z w : A, z ∈ t → w ∈ t → z.val.x < 1 / 2 → 1 / 2 < w.val.x → False := by
      intro z w hz hw hzx hwx
      obtain ⟨q, -, hq1, hq2⟩ := ht _ _ (hA.isOpen_x_lt (t := 1 / 2) (by norm_num) (.inl le_rfl)
        (by norm_num)) (hA.isOpen_lt_x (t := 1 / 2) (by norm_num) (.inl le_rfl) (by norm_num))
        (fun q hq ↦ hside q hq) ⟨z, hz, hzx⟩ ⟨w, hw, hwx⟩
      simp only [mem_ofPred_eq] at hq1 hq2
      linarith
    rcases hcorner z hz with h | h <;> rcases hcorner w hw with h' | h'
    · exact hx (by rw [h, h'])
    · exact key z w hz hw (by rw [h]; norm_num) (by rw [h']; norm_num)
    · exact key w z hw hz (by rw [h']; norm_num) (by rw [h]; norm_num)
    · exact hx (by rw [h, h'])
  · -- No point of `t` lies on the line `x = 1/2`, unless `z` or `w` does.
    have hzx : z.val.x ≠ 1 / 2 := by
      intro hzx
      by_cases hwx : w.val.x = 1 / 2
      · exact hx (hzx.trans hwx.symm)
      · exact hA.y_ne w.val w.property z.val z.property hwx hzx (hyt w hw)
    have htx : ∀ q ∈ t, q.val.x ≠ 1 / 2 := fun q hq hqx ↦
      hA.y_ne z.val z.property q.val q.property hzx hqx (hyt q hq).symm
    have hcont : ContinuousOn (fun q : A ↦ q.val.x) t := fun q hq ↦
      ((continuousAt_x (by rw [hyt q hq]; exact h0) (htx q hq)).comp
        continuous_subtypeVal.continuousAt).continuousWithinAt
    have hsub : (fun q : A ↦ q.val.x) '' t ⊆ x '' A := by
      rintro _ ⟨q, -, rfl⟩
      exact ⟨q.val, q.property, rfl⟩
    exact hx ((hc.image x).isTotallyDisconnected _ hsub (ht.image _ hcont) ⟨z, hz, rfl⟩
      ⟨w, hw, rfl⟩)

theorem not_hasIsolatedPoint

TopologyByExample.ArensPlane.IsArensSet.not_hasIsolatedPoint

The subspace has no isolated point: every basic neighbourhood of a point contains another point of A.

theorem not_hasIsolatedPoint : ¬HasIsolatedPoint A
Proof
:= by
  rintro ⟨z, hz⟩
  obtain ⟨ε, hε, hsub⟩ := (hasBasis_nhds_sub z).mem_iff.1 (hz.mem_nhds rfl)
  -- It suffices to find a point of `A` in `basic z ε` other than `z`.
  suffices ∃ u : A, u.val ∈ basic z.val ε ∧ u ≠ z by
    obtain ⟨u, hu, huz⟩ := this
    exact huz (hsub hu)
  rcases hA.mem z.val z.property with h | h | ⟨hx0, hx1, hy0, hy1⟩
  · obtain ⟨u, h1, h2, h3, h4, -, -⟩ := hA.exists_pick (a := 0) (b := 1 / 4) (c := 0)
      (d := min ε 1) le_rfl (by norm_num) (by norm_num) le_rfl (lt_min hε one_pos)
      (min_le_right _ _)
    refine ⟨u, ?_, fun hu ↦ ?_⟩
    · rw [h, basic_left (by simp) (by simp)]
      exact .inr ⟨h2, by rw [abs_lt]; constructor <;> linarith [min_le_left ε 1]⟩
    · rw [hu, h] at h3; simp at h3
  · obtain ⟨u, h1, h2, h3, h4, -, -⟩ := hA.exists_pick (a := 3 / 4) (b := 1) (c := 0)
      (d := min ε 1) (by norm_num) (by norm_num) le_rfl le_rfl (lt_min hε one_pos)
      (min_le_right _ _)
    refine ⟨u, ?_, fun hu ↦ ?_⟩
    · rw [h, basic_right (by simp) (by simp; norm_num)]
      exact .inr ⟨h1, by rw [abs_lt]; constructor <;> linarith [min_le_left ε 1]⟩
    · rw [hu, h] at h3; simp at h3
  · by_cases hx : z.val.x = 1 / 2
    · obtain ⟨u, h1, h2, h3, h4, -, hu0⟩ := hA.exists_pick (a := 1 / 4) (b := 1 / 2)
        (c := max 0 (z.val.y - ε)) (d := min 1 (z.val.y + ε)) (by norm_num) (by norm_num)
        (by norm_num) (le_max_left _ _)
        (max_lt (lt_min (by linarith) (by linarith)) (lt_min (by linarith) (by linarith)))
        (min_le_left _ _)
      refine ⟨u, ?_, fun hu ↦ ?_⟩
      · rw [basic_mid hy0.ne' hx]
        exact ⟨h1, by linarith, hu0, by
          rw [abs_lt]; constructor <;> linarith [le_max_right 0 (z.val.y - ε),
            min_le_right 1 (z.val.y + ε)]⟩
      · rw [hu, hx] at h2; linarith
    · obtain ⟨u, h1, h2, h3, h4, hux, hu0⟩ := hA.exists_pick (a := z.val.x)
        (b := min 1 (z.val.x + ε)) (c := max 0 (z.val.y - ε)) (d := min 1 (z.val.y + ε)) hx0.le
        (lt_min hx1 (by linarith)) (min_le_left _ _) (le_max_left _ _)
        (max_lt (lt_min (by linarith) (by linarith)) (lt_min (by linarith) (by linarith)))
        (min_le_left _ _)
      refine ⟨u, ?_, fun hu ↦ ?_⟩
      · rw [basic_ord hy0.ne' hx]
        refine ⟨?_, ?_, hu0, hux⟩ <;> rw [abs_lt] <;> constructor <;>
          linarith [le_max_right 0 (z.val.y - ε), min_le_right 1 (z.val.y + ε),
            min_le_right 1 (z.val.x + ε)]
      · rw [hu] at h1; exact lt_irrefl _ h1

theorem not_pseudocompactSpace

TopologyByExample.ArensPlane.IsArensSet.not_pseudocompactSpace

A countable subspace is not pseudocompact. The heights of its points are countably many, so some s ∈ (0, 1) is not among them, but heights of points of A come arbitrarily close to s from above; so 1 / (y - s) is a continuous unbounded function.

theorem not_pseudocompactSpace (hc : A.Countable) : ¬PseudocompactSpace A
Proof
:= by
  intro hP
  obtain ⟨s, ⟨hs0, hs1⟩, hsA⟩ : (Ioo (0 : ℝ) 1 \ y '' A).Nonempty := by
    by_contra h
    rw [not_nonempty_iff_eq_empty, sdiff_eq_empty] at h
    exact absurd ((hc.image y).mono h) (by simp)
  have hne : ∀ q : A, q.val.y - s ≠ 0 := fun q h ↦
    hsA ⟨q.val, q.property, by linarith [sub_eq_zero.1 h]⟩
  let f : C(A, ℝ) := ⟨fun q ↦ 1 / (q.val.y - s),
    continuous_const.div (continuous_y_sub.sub continuous_const) hne⟩
  obtain ⟨C, hC⟩ := (hP.bddAbove_and_bddBelow_range f).1
  set C' := max C 0 + 1
  obtain ⟨u, -, -, h3, h4, -, -⟩ := hA.exists_pick (a := 0) (b := 1) (c := s)
    (d := min 1 (s + 1 / C')) le_rfl one_pos le_rfl hs0.le
    (lt_min hs1 (lt_add_of_pos_right s (by positivity))) (min_le_left _ _)
  have hfu : f u ≤ C := hC ⟨u, rfl⟩
  have hpos : 0 < u.val.y - s := by linarith
  have hlt : u.val.y - s < 1 / C' := by linarith [min_le_right 1 (s + 1 / C')]
  have : C' < f u := by
    change C' < 1 / (u.val.y - s)
    rw [lt_one_div (by positivity) hpos]
    exact hlt
  linarith [le_max_left C 0]

Semiregularity

theorem y_nonneg

TopologyByExample.ArensPlane.IsArensSet.y_nonneg

The points of a subspace have nonnegative heights.

theorem y_nonneg (z : A) : 0 ≤ z.val.y
Proof
:= by
  rcases hA.mem z.val z.property with h | h | h
  · simp [h]
  · simp [h]
  · exact h.2.2.1.le
omit hA in

theorem closure_subset_band

TopologyByExample.ArensPlane.IsArensSet.closure_subset_band

The closure of a set of points in a closed horizontal band lies in the band.

theorem closure_subset_band {S : Set A} {c r : ℝ} (h : ∀ q ∈ S, |q.val.y - c| ≤ r) :
    ∀ q ∈ closure S, |q.val.y - c| ≤ r
Proof
:=
  fun _ hq ↦ closure_minimal (show S ⊆ {q : A | |q.val.y - c| ≤ r} from h)
    (isClosed_le ((continuous_y_sub.sub continuous_const).abs) continuous_const) hq

theorem isClosed_x_le_quarter

TopologyByExample.ArensPlane.IsArensSet.isClosed_x_le_quarter

The points of A with x ≤ 1/4 form a closed set.

theorem isClosed_x_le_quarter : IsClosed {q : A | q.val.x ≤ 1 / 4}
Proof
:= by
  rw [← isOpen_compl_iff]
  convert hA.isOpen_lt_x (t := 1 / 4) (by norm_num) (.inr le_rfl) (by norm_num) using 1
  ext; simp [not_le]

theorem isClosed_le_x_three_quarters

TopologyByExample.ArensPlane.IsArensSet.isClosed_le_x_three_quarters

The points of A with 3/4 ≤ x form a closed set.

theorem isClosed_le_x_three_quarters : IsClosed {q : A | 3 / 4 ≤ q.val.x}
Proof
:= by
  rw [← isOpen_compl_iff]
  convert hA.isOpen_x_lt (t := 3 / 4) (by norm_num) (.inr le_rfl) (by norm_num) using 1
  ext; simp [not_le]

theorem isClosed_quarter_le_x

TopologyByExample.ArensPlane.IsArensSet.isClosed_quarter_le_x

The points of A with 1/4 ≤ x form a closed set.

theorem isClosed_quarter_le_x : IsClosed {q : A | 1 / 4 ≤ q.val.x}
Proof
:= by
  rw [← isOpen_compl_iff]
  convert hA.isOpen_x_lt (t := 1 / 4) le_rfl (.inl (by norm_num)) (by norm_num) using 1
  ext; simp [not_le]

theorem isClosed_x_le_three_quarters

TopologyByExample.ArensPlane.IsArensSet.isClosed_x_le_three_quarters

The points of A with x ≤ 3/4 form a closed set.

theorem isClosed_x_le_three_quarters : IsClosed {q : A | q.val.x ≤ 3 / 4}
Proof
:= by
  rw [← isOpen_compl_iff]
  convert hA.isOpen_lt_x (t := 3 / 4) le_rfl (.inl (by norm_num)) (by norm_num) using 1
  ext; simp [not_le]
omit hA in

theorem isClosed_ordBox

TopologyByExample.ArensPlane.IsArensSet.isClosed_ordBox

Near an ordinary point z, the points of A within r of the height of z that lie on the line x = 1/2 or within r of z horizontally form a closed set, if r < z.y.

theorem isClosed_ordBox (z : ArensPlane) {r : ℝ} (hr : r < z.y) :
    IsClosed {q : A | |q.val.y - z.y| ≤ r ∧ (q.val.x = 1 / 2 ∨ |q.val.x - z.x| ≤ r)}
Proof
:= by
  rw [← isOpen_compl_iff]
  refine isOpen_iff_mem_nhds.2 fun q hq ↦ ?_
  by_cases hq1 : r < |q.val.y - z.y|
  · refine mem_of_superset ((isOpen_lt continuous_const
      ((continuous_y_sub.sub continuous_const).abs)).mem_nhds hq1) fun p hp hpC ↦ ?_
    exact (not_le.2 hp) hpC.1
  · have hq' : ¬(q.val.x = 1 / 2 ∨ |q.val.x - z.x| ≤ r) := fun h ↦ hq ⟨not_lt.1 hq1, h⟩
    push Not at hq'
    obtain ⟨hqx, hqx'⟩ := hq'
    have hq0 : q.val.y ≠ 0 := by
      intro h
      rw [h, zero_sub, abs_neg] at hq1
      exact hq1 (hr.trans_le (le_abs_self _))
    refine (hasBasis_nhds_sub q).mem_iff.2 ⟨|q.val.x - z.x| - r, by linarith, fun p hp hpC ↦ ?_⟩
    rw [mem_preimage, basic_ord hq0 hqx] at hp
    obtain ⟨hp1, -, -, hp4⟩ := hp
    rcases hpC.2 with h | h
    · exact hp4 h
    · have := abs_sub_le q.val.x p.val.x z.x
      rw [abs_sub_comm q.val.x p.val.x] at this
      linarith

theorem exists_mem_basic_ord

TopologyByExample.ArensPlane.IsArensSet.exists_mem_basic_ord

Points of A near an ordinary point of A, in a given range of horizontal coordinates.

theorem exists_mem_basic_ord (w : A) (hw0 : 0 < w.val.y) (hw1 : w.val.y < 1)
    (hwx : w.val.x ≠ 1 / 2) {δ : ℝ} (hδ : 0 < δ) {a b : ℝ} (ha : 0 ≤ a) (hab : a < b)
    (hb : b ≤ 1) (ha' : w.val.x - δ ≤ a) (hb' : b ≤ w.val.x + δ) :
    ∃ u : A, u.val ∈ basic w.val δ ∧ a < u.val.x ∧ u.val.x < b
Proof
:= by
  obtain ⟨u, h1, h2, h3, h4, hux, hu0⟩ := hA.exists_pick (a := a) (b := b)
    (c := max 0 (w.val.y - δ)) (d := min 1 (w.val.y + δ)) ha hab hb (le_max_left _ _)
    (max_lt (lt_min (by linarith) (by linarith)) (lt_min (by linarith) (by linarith)))
    (min_le_left _ _)
  refine ⟨u, ?_, h1, h2⟩
  rw [basic_ord hw0.ne' hwx]
  refine ⟨abs_lt.2 ⟨by linarith, by linarith⟩, abs_lt.2 ⟨?_, ?_⟩, hu0, hux⟩
  · linarith [le_max_right 0 (w.val.y - δ)]
  · linarith [min_le_right 1 (w.val.y + δ)]

theorem exists_mem_basic_mid

TopologyByExample.ArensPlane.IsArensSet.exists_mem_basic_mid

Points of A near a point of A on the line x = 1/2, in a given range of horizontal coordinates.

theorem exists_mem_basic_mid (w : A) (hw0 : 0 < w.val.y) (hw1 : w.val.y < 1)
    (hwx : w.val.x = 1 / 2) {δ : ℝ} (hδ : 0 < δ) {a b : ℝ} (ha : 1 / 4 ≤ a) (hab : a < b)
    (hb : b ≤ 3 / 4) :
    ∃ u : A, u.val ∈ basic w.val δ ∧ a < u.val.x ∧ u.val.x < b ∧ u.val.x ≠ 1 / 2
Proof
:= by
  obtain ⟨u, h1, h2, h3, h4, hux, hu0⟩ := hA.exists_pick (a := a) (b := b)
    (c := max 0 (w.val.y - δ)) (d := min 1 (w.val.y + δ)) (by linarith) hab (by linarith)
    (le_max_left _ _)
    (max_lt (lt_min (by linarith) (by linarith)) (lt_min (by linarith) (by linarith)))
    (min_le_left _ _)
  refine ⟨u, ?_, h1, h2, hux⟩
  rw [basic_mid hw0.ne' hwx]
  refine ⟨by linarith, by linarith, hu0, abs_lt.2 ⟨?_, ?_⟩⟩
  · linarith [le_max_right 0 (w.val.y - δ)]
  · linarith [min_le_right 1 (w.val.y + δ)]

theorem exists_mem_basic_left

TopologyByExample.ArensPlane.IsArensSet.exists_mem_basic_left

Points of A near the left corner, below a given height.

theorem exists_mem_basic_left {δ d : ℝ} (hd : 0 < d) (hdδ : d ≤ δ) (hd1 : d ≤ 1) :
    ∃ u : A, u.val ∈ basic (ArensPlane.mk 0 0) δ ∧ u.val.y < d
Proof
:= by
  obtain ⟨u, -, h2, h3, h4, -, -⟩ := hA.exists_pick (a := 0) (b := 1 / 4) (c := 0) (d := d)
    le_rfl (by norm_num) (by norm_num) le_rfl hd hd1
  refine ⟨u, ?_, h4⟩
  rw [basic_left (by simp) (by simp)]
  exact .inr ⟨h2, abs_lt.2 ⟨by linarith, by linarith⟩⟩

theorem exists_mem_basic_right

TopologyByExample.ArensPlane.IsArensSet.exists_mem_basic_right

Points of A near the right corner, below a given height.

theorem exists_mem_basic_right {δ d : ℝ} (hd : 0 < d) (hdδ : d ≤ δ) (hd1 : d ≤ 1) :
    ∃ u : A, u.val ∈ basic (ArensPlane.mk 1 0) δ ∧ u.val.y < d
Proof
:= by
  obtain ⟨u, h1, -, h3, h4, -, -⟩ := hA.exists_pick (a := 3 / 4) (b := 1) (c := 0) (d := d)
    (by norm_num) (by norm_num) le_rfl le_rfl hd hd1
  refine ⟨u, ?_, h4⟩
  rw [basic_right (by simp) (by simp; norm_num)]
  exact .inr ⟨h1, abs_lt.2 ⟨by linarith, by linarith⟩⟩

theorem interior_closure_basic_subset

TopologyByExample.ArensPlane.IsArensSet.interior_closure_basic_subset

The interior of the closure of the basic neighbourhood of radius ε / 2 lies in the basic neighbourhood of radius ε, for ε ≤ 1/8, and, at an ordinary point, ε below its height.

theorem interior_closure_basic_subset (z : A) {ε : ℝ} (hε : 0 < ε) (h8 : ε ≤ 1 / 8)
    (hord : z.val.y ≠ 0 → ε < z.val.y) :
    interior (closure (((↑) : A → ArensPlane) ⁻¹' basic z.val (ε / 2))) ⊆
      ((↑) : A → ArensPlane) ⁻¹' basic z.val ε
Proof
:= by
  intro w hw
  obtain ⟨δ, hδ, hwδ⟩ := (hasBasis_nhds_sub w).mem_iff.1 (mem_interior_iff_mem_nhds.1 hw)
  have hwc := interior_subset hw
  set B := Subtype.val ⁻¹' basic z.val (ε / 2)
  have hu : ∀ u : A, u.val ∈ basic w.val δ → u ∈ closure B := fun u h ↦ hwδ h
  rcases hA.mem z.val z.property with hz | hz | ⟨hzx0, hzx1, hzy0, hzy1⟩
  · -- The left corner.
    have hB : ∀ q ∈ closure B, q.val.x ≤ 1 / 4 := fun q hq ↦ closure_minimal (fun p hp ↦ by
      change p.val ∈ basic z.val (ε / 2) at hp
      rw [hz, basic_left (by simp) (by simp)] at hp
      rcases hp with hp | hp
      · simp [hp]
      · exact hp.1.le) hA.isClosed_x_le_quarter hq
    have hBy := closure_subset_band (S := B) (c := 0) (r := ε / 2) fun p hp ↦ by
      change p.val ∈ basic z.val (ε / 2) at hp
      rw [hz, basic_left (by simp) (by simp)] at hp
      rcases hp with hp | hp
      · rw [hp, y_mk, sub_zero, abs_zero]; positivity
      · simpa using hp.2.le
    rcases hA.mem w.val w.property with hw' | hw' | ⟨hwx0, hwx1, hwy0, hwy1⟩
    · change w.val ∈ basic z.val ε
      rw [hw', hz]; exact mem_basic_self _ hε
    · have := hB w hwc; simp [hw'] at this; linarith
    · have hx := hB w hwc
      have hwx : w.val.x ≠ 1 / 2 := by intro h; linarith
      have hlt : w.val.x < 1 / 4 := by
        refine lt_of_le_of_ne hx fun h ↦ ?_
        obtain ⟨u, hu1, hu2, -⟩ := hA.exists_mem_basic_ord w hwy0 hwy1 hwx hδ (a := 1 / 4)
          (b := min 1 (1 / 4 + δ)) (by norm_num) (lt_min (by norm_num) (by linarith))
          (min_le_left _ _) (by linarith) (by linarith [min_le_right 1 (1 / 4 + δ)])
        linarith [hB u (hu u hu1)]
      change w.val ∈ basic z.val ε
      rw [hz, basic_left (by simp) (by simp)]
      have := hBy w hwc
      exact .inr ⟨hlt, by rw [sub_zero] at this; linarith⟩
  · -- The right corner.
    have hB : ∀ q ∈ closure B, 3 / 4 ≤ q.val.x := fun q hq ↦ closure_minimal (fun p hp ↦ by
      change p.val ∈ basic z.val (ε / 2) at hp
      rw [hz, basic_right (by simp) (by simp; norm_num)] at hp
      rcases hp with hp | hp
      · simp [hp]; norm_num
      · exact hp.1.le) hA.isClosed_le_x_three_quarters hq
    have hBy := closure_subset_band (S := B) (c := 0) (r := ε / 2) fun p hp ↦ by
      change p.val ∈ basic z.val (ε / 2) at hp
      rw [hz, basic_right (by simp) (by simp; norm_num)] at hp
      rcases hp with hp | hp
      · rw [hp, y_mk, sub_zero, abs_zero]; positivity
      · simpa using hp.2.le
    rcases hA.mem w.val w.property with hw' | hw' | ⟨hwx0, hwx1, hwy0, hwy1⟩
    · have := hB w hwc; simp [hw'] at this; linarith
    · change w.val ∈ basic z.val ε
      rw [hw', hz]; exact mem_basic_self _ hε
    · have hx := hB w hwc
      have hwx : w.val.x ≠ 1 / 2 := by intro h; linarith
      have hlt : 3 / 4 < w.val.x := by
        refine lt_of_le_of_ne hx fun h ↦ ?_
        obtain ⟨u, hu1, -, hu3⟩ := hA.exists_mem_basic_ord w hwy0 hwy1 hwx hδ
          (a := max 0 (3 / 4 - δ)) (b := 3 / 4) (le_max_left _ _)
          (max_lt (by norm_num) (by linarith)) (by norm_num)
          (by linarith [le_max_right 0 (3 / 4 - δ)]) (by linarith)
        linarith [hB u (hu u hu1)]
      change w.val ∈ basic z.val ε
      rw [hz, basic_right (by simp) (by simp; norm_num)]
      have := hBy w hwc
      exact .inr ⟨hlt, by rw [sub_zero] at this; linarith⟩
  by_cases hzx : z.val.x = 1 / 2
  · -- A point on the line `x = 1/2`.
    have hB1 : ∀ q ∈ closure B, 1 / 4 ≤ q.val.x := fun q hq ↦ closure_minimal (fun p hp ↦ by
      change p.val ∈ basic z.val (ε / 2) at hp
      rw [basic_mid hzy0.ne' hzx] at hp
      exact hp.1.le) hA.isClosed_quarter_le_x hq
    have hB2 : ∀ q ∈ closure B, q.val.x ≤ 3 / 4 := fun q hq ↦ closure_minimal (fun p hp ↦ by
      change p.val ∈ basic z.val (ε / 2) at hp
      rw [basic_mid hzy0.ne' hzx] at hp
      exact hp.2.1.le) hA.isClosed_x_le_three_quarters hq
    have hBy := closure_subset_band (S := B) (c := z.val.y) (r := ε / 2) fun p hp ↦ by
      change p.val ∈ basic z.val (ε / 2) at hp
      rw [basic_mid hzy0.ne' hzx] at hp
      exact hp.2.2.2.le
    rcases hA.mem w.val w.property with hw' | hw' | ⟨hwx0, hwx1, hwy0, hwy1⟩
    · have := hB1 w hwc; simp [hw'] at this; linarith
    · have := hB2 w hwc; simp [hw'] at this; linarith
    · have hy := hBy w hwc
      change w.val ∈ basic z.val ε
      rw [basic_mid hzy0.ne' hzx]
      by_cases hwx : w.val.x = 1 / 2
      · exact ⟨by rw [hwx]; norm_num, by rw [hwx]; norm_num, hwy0.ne', by linarith⟩
      · have h1 : 1 / 4 < w.val.x := by
          refine lt_of_le_of_ne (hB1 w hwc) fun h ↦ ?_
          obtain ⟨u, hu1, -, hu3⟩ := hA.exists_mem_basic_ord w hwy0 hwy1 hwx hδ
            (a := max 0 (1 / 4 - δ)) (b := 1 / 4) (le_max_left _ _)
            (max_lt (by norm_num) (by linarith)) (by norm_num)
            (by linarith [le_max_right 0 (1 / 4 - δ)]) (by linarith)
          linarith [hB1 u (hu u hu1)]
        have h2 : w.val.x < 3 / 4 := by
          refine lt_of_le_of_ne (hB2 w hwc) fun h ↦ ?_
          obtain ⟨u, hu1, hu2, -⟩ := hA.exists_mem_basic_ord w hwy0 hwy1 hwx hδ (a := 3 / 4)
            (b := min 1 (3 / 4 + δ)) (by norm_num) (lt_min (by norm_num) (by linarith))
            (min_le_left _ _) (by linarith) (by linarith [min_le_right 1 (3 / 4 + δ)])
          linarith [hB2 u (hu u hu1)]
        exact ⟨h1, h2, hwy0.ne', by linarith⟩
  · -- An ordinary point.
    have hεz := hord hzy0.ne'
    have hB : ∀ q ∈ closure B, |q.val.y - z.val.y| ≤ ε / 2 ∧
        (q.val.x = 1 / 2 ∨ |q.val.x - z.val.x| ≤ ε / 2) := fun q hq ↦
      closure_minimal (fun p hp ↦ by
        change p.val ∈ basic z.val (ε / 2) at hp
        rw [basic_ord hzy0.ne' hzx] at hp
        exact ⟨hp.2.1.le, .inr hp.1.le⟩) (isClosed_ordBox z.val (by linarith)) hq
    rcases hA.mem w.val w.property with hw' | hw' | ⟨hwx0, hwx1, hwy0, hwy1⟩
    · obtain ⟨u, hu1, hu2⟩ := hA.exists_mem_basic_left (δ := δ)
        (d := min (min δ 1) (z.val.y - ε / 2)) (lt_min (lt_min hδ one_pos) (by linarith))
        ((min_le_left _ _).trans (min_le_left _ _)) ((min_le_left _ _).trans (min_le_right _ _))
      rw [← hw'] at hu1
      have := (hB u (hu u hu1)).1
      rw [abs_le] at this
      linarith [min_le_right (min δ 1) (z.val.y - ε / 2)]
    · obtain ⟨u, hu1, hu2⟩ := hA.exists_mem_basic_right (δ := δ)
        (d := min (min δ 1) (z.val.y - ε / 2)) (lt_min (lt_min hδ one_pos) (by linarith))
        ((min_le_left _ _).trans (min_le_left _ _)) ((min_le_left _ _).trans (min_le_right _ _))
      rw [← hw'] at hu1
      have := (hB u (hu u hu1)).1
      rw [abs_le] at this
      linarith [min_le_right (min δ 1) (z.val.y - ε / 2)]
    · by_cases hwx : w.val.x = 1 / 2
      · -- Points of the strip far from `z` horizontally.
        have hfar : ∃ u : A, u.val ∈ basic w.val δ ∧ u.val.x ≠ 1 / 2 ∧
            ε / 2 < |u.val.x - z.val.x| := by
          by_cases hz2 : z.val.x ≤ 1 / 2
          · obtain ⟨u, hu1, hu2, hu3, hux⟩ := hA.exists_mem_basic_mid w hwy0 hwy1 hwx hδ
              (a := 5 / 8) (b := 3 / 4) (by norm_num) (by norm_num) le_rfl
            exact ⟨u, hu1, hux, lt_of_lt_of_le (by linarith) (le_abs_self _)⟩
          · obtain ⟨u, hu1, hu2, hu3, hux⟩ := hA.exists_mem_basic_mid w hwy0 hwy1 hwx hδ
              (a := 1 / 4) (b := 3 / 8) le_rfl (by norm_num) (by norm_num)
            refine ⟨u, hu1, hux, ?_⟩
            rw [abs_sub_comm]
            exact lt_of_lt_of_le (by linarith) (le_abs_self _)
        obtain ⟨u, hu1, hux, hfar⟩ := hfar
        rcases (hB u (hu u hu1)).2 with h | h
        · exact absurd h hux
        · linarith
      · obtain ⟨hy, hx⟩ := hB w hwc
        change w.val ∈ basic z.val ε
        rw [basic_ord hzy0.ne' hzx]
        rcases hx with hx | hx
        · exact absurd hx hwx
        · exact ⟨by linarith, by linarith, hwy0.ne', hwx⟩

theorem semiregularSpace

TopologyByExample.ArensPlane.IsArensSet.semiregularSpace

The subspace is semiregular: the interior of the closure of a small basic neighbourhood is a regular open set inside a larger one.

theorem semiregularSpace : SemiregularSpace A
Proof
:= by
  rw [semiregularSpace_iff_isRegularOpen]
  refine isTopologicalBasis_of_isOpen_of_nhds (fun _ hs ↦ hs.isOpen) fun z U hz hU ↦ ?_
  obtain ⟨ε₀, hε₀, hsub⟩ := (hasBasis_nhds_sub z).mem_iff.1 (hU.mem_nhds hz)
  obtain ⟨ε, hε, hεε₀, h8, hord⟩ : ∃ ε : ℝ, 0 < ε ∧ ε ≤ ε₀ ∧ ε ≤ 1 / 8 ∧
      (z.val.y ≠ 0 → ε < z.val.y) := by
    by_cases hz0 : z.val.y = 0
    · exact ⟨min ε₀ (1 / 8), lt_min hε₀ (by norm_num), min_le_left _ _, min_le_right _ _,
        fun h ↦ absurd hz0 h⟩
    · have hzpos : 0 < z.val.y := lt_of_le_of_ne (hA.y_nonneg z) (Ne.symm hz0)
      exact ⟨min (min ε₀ (1 / 8)) (z.val.y / 2), lt_min (lt_min hε₀ (by norm_num)) (by linarith),
        (min_le_left _ _).trans (min_le_left _ _), (min_le_left _ _).trans (min_le_right _ _),
        fun _ ↦ (min_le_right _ _).trans_lt (by linarith)⟩
  refine ⟨interior (closure (Subtype.val ⁻¹' basic z.val (ε / 2))),
    isRegularOpen_interior_closure _, ?_, ?_⟩
  · exact ((isOpen_basic z.val (half_pos hε)).preimage
      continuous_subtypeVal).subset_interior_closure (mem_basic_self z.val (half_pos hε))
  · exact (hA.interior_closure_basic_subset z hε h8 hord).trans
      ((preimage_mono (basic_mono _ hεε₀)).trans hsub)

Closures of basic neighbourhoods

theorem exists_mem_basic_ord_box

TopologyByExample.ArensPlane.IsArensSet.exists_mem_basic_ord_box

Points of A near an ordinary point of A, in a given box.

theorem exists_mem_basic_ord_box (w : A) (hw0 : w.val.y ≠ 0) (hwx : w.val.x ≠ 1 / 2) {δ : ℝ}
    {a b c d : ℝ} (ha : 0 ≤ a) (hab : a < b) (hb : b ≤ 1) (hc : 0 ≤ c) (hcd : c < d) (hd : d ≤ 1)
    (ha' : w.val.x - δ ≤ a) (hb' : b ≤ w.val.x + δ) (hc' : w.val.y - δ ≤ c)
    (hd' : d ≤ w.val.y + δ) :
    ∃ u : A, u.val ∈ basic w.val δ ∧ a < u.val.x ∧ u.val.x < b ∧ c < u.val.y ∧ u.val.y < d
Proof
:= by
  obtain ⟨u, h1, h2, h3, h4, hux, hu0⟩ := hA.exists_pick ha hab hb hc hcd hd
  refine ⟨u, ?_, h1, h2, h3, h4⟩
  rw [basic_ord hw0 hwx]
  exact ⟨abs_lt.2 ⟨by linarith, by linarith⟩, abs_lt.2 ⟨by linarith, by linarith⟩, hu0, hux⟩

theorem mem_closure_basic_left

TopologyByExample.ArensPlane.IsArensSet.mem_closure_basic_left

A point of A on the line x = 1/4, below height δ, lies in the closure of the basic neighbourhood of radius δ of the left corner.

theorem mem_closure_basic_left (u : A) (hux : u.val.x = 1 / 4) (hu0 : 0 < u.val.y)
    {δ : ℝ} (huδ : u.val.y < δ) :
    u ∈ closure (((↑) : A → ArensPlane) ⁻¹' basic (ArensPlane.mk 0 0) δ)
Proof
:= by
  have hu1 : u.val.y < 1 := by
    rcases hA.mem u.val u.property with h | h | h
    · norm_num [h] at hux
    · norm_num [h] at hux
    · exact h.2.2.2
  refine (mem_closure_iff_nhds_basis' (hasBasis_nhds_sub u)).2 fun η hη ↦ ?_
  obtain ⟨v, hv, h1, h2, h3, h4⟩ := hA.exists_mem_basic_ord_box u hu0.ne'
    (by rw [hux]; norm_num) (a := max 0 (1 / 4 - η)) (b := 1 / 4)
    (c := max 0 (u.val.y - η)) (d := min δ (min 1 (u.val.y + η))) (le_max_left _ _)
    (max_lt (by norm_num) (by linarith)) (by norm_num) (le_max_left _ _)
    (max_lt (lt_min (by linarith) (lt_min one_pos (by linarith)))
      (lt_min (by linarith) (lt_min (by linarith) (by linarith))))
    ((min_le_right _ _).trans (min_le_left _ _))
    (by rw [hux]; exact le_max_right _ _) (by rw [hux]; linarith) (le_max_right _ _)
    ((min_le_right _ _).trans (min_le_right _ _))
  refine ⟨v, hv, ?_⟩
  change v.val ∈ basic (ArensPlane.mk 0 0) δ
  rw [basic_left (by simp) (by simp)]
  exact .inr ⟨h2, abs_lt.2 ⟨by linarith [le_max_left 0 (u.val.y - η)],
    h4.trans_le (min_le_left _ _)⟩⟩

theorem mem_closure_basic_right

TopologyByExample.ArensPlane.IsArensSet.mem_closure_basic_right

A point of A on the line x = 3/4, below height δ, lies in the closure of the basic neighbourhood of radius δ of the right corner.

theorem mem_closure_basic_right (u : A) (hux : u.val.x = 3 / 4) (hu0 : 0 < u.val.y)
    {δ : ℝ} (huδ : u.val.y < δ) :
    u ∈ closure (((↑) : A → ArensPlane) ⁻¹' basic (ArensPlane.mk 1 0) δ)
Proof
:= by
  have hu1 : u.val.y < 1 := by
    rcases hA.mem u.val u.property with h | h | h
    · norm_num [h] at hux
    · norm_num [h] at hux
    · exact h.2.2.2
  refine (mem_closure_iff_nhds_basis' (hasBasis_nhds_sub u)).2 fun η hη ↦ ?_
  obtain ⟨v, hv, h1, h2, h3, h4⟩ := hA.exists_mem_basic_ord_box u hu0.ne'
    (by rw [hux]; norm_num) (a := 3 / 4) (b := min 1 (3 / 4 + η))
    (c := max 0 (u.val.y - η)) (d := min δ (min 1 (u.val.y + η))) (by norm_num)
    (lt_min (by norm_num) (by linarith)) (min_le_left _ _) (le_max_left _ _)
    (max_lt (lt_min (by linarith) (lt_min one_pos (by linarith)))
      (lt_min (by linarith) (lt_min (by linarith) (by linarith))))
    ((min_le_right _ _).trans (min_le_left _ _))
    (by rw [hux]; linarith) (by rw [hux]; exact min_le_right _ _) (le_max_right _ _)
    ((min_le_right _ _).trans (min_le_right _ _))
  refine ⟨v, hv, ?_⟩
  change v.val ∈ basic (ArensPlane.mk 1 0) δ
  rw [basic_right (by simp) (by simp; norm_num)]
  exact .inr ⟨h1, abs_lt.2 ⟨by linarith [le_max_left 0 (u.val.y - η)],
    h4.trans_le (min_le_left _ _)⟩⟩

theorem mem_closure_basic_mid

TopologyByExample.ArensPlane.IsArensSet.mem_closure_basic_mid

An ordinary point u of A with 1/4 ≤ x ≤ 3/4 lies in the closure of the basic neighbourhood of radius δ of a point m on the line x = 1/2 whose height is within δ of its own.

theorem mem_closure_basic_mid (u : A) (hu0 : 0 < u.val.y) (hux : u.val.x ≠ 1 / 2)
    (hux1 : 1 / 4 ≤ u.val.x) (hux2 : u.val.x ≤ 3 / 4) {m : ArensPlane} (hm0 : m.y ≠ 0)
    (hmx : m.x = 1 / 2) {δ : ℝ} (hδ : |u.val.y - m.y| < δ) :
    u ∈ closure (((↑) : A → ArensPlane) ⁻¹' basic m δ)
Proof
:= by
  have hu1 : u.val.y < 1 := by
    rcases hA.mem u.val u.property with h | h | h
    · simp [h] at hu0
    · simp [h] at hu0
    · exact h.2.2.2
  rw [abs_lt] at hδ
  refine (mem_closure_iff_nhds_basis' (hasBasis_nhds_sub u)).2 fun η hη ↦ ?_
  -- A horizontal range inside `(1/4, 3/4)` within `η` of `u`.
  obtain ⟨a, b, ha, hab, hb, ha', hb'⟩ : ∃ a b : ℝ, 1 / 4 ≤ a ∧ a < b ∧ b ≤ 3 / 4 ∧
      u.val.x - η ≤ a ∧ b ≤ u.val.x + η := by
    by_cases h : u.val.x < 1 / 2
    · exact ⟨u.val.x, min (3 / 4) (u.val.x + η), hux1, lt_min (by linarith) (by linarith),
        min_le_left _ _, by linarith, min_le_right _ _⟩
    · exact ⟨max (1 / 4) (u.val.x - η), u.val.x, le_max_left _ _,
        max_lt (by linarith) (by linarith), hux2, le_max_right _ _, by linarith⟩
  obtain ⟨v, hv, h1, h2, h3, h4⟩ := hA.exists_mem_basic_ord_box u hu0.ne' hux (δ := η)
    (a := a) (b := b) (c := max 0 (max (u.val.y - η) (m.y - δ)))
    (d := min 1 (min (u.val.y + η) (m.y + δ))) (by linarith) hab (by linarith) (le_max_left _ _)
    (max_lt (lt_min (by linarith) (lt_min (by linarith) (by linarith)))
      (max_lt (lt_min (by linarith) (lt_min (by linarith) (by linarith)))
        (lt_min (by linarith) (lt_min (by linarith) (by linarith)))))
    (min_le_left _ _) ha' hb' ((le_max_left _ _).trans (le_max_right _ _))
    ((min_le_right _ _).trans (min_le_left _ _))
  refine ⟨v, hv, ?_⟩
  change v.val ∈ basic m δ
  rw [basic_mid hm0 hmx]
  refine ⟨by linarith, by linarith, by linarith [le_max_left 0 (max (u.val.y - η) (m.y - δ))],
    abs_lt.2 ⟨?_, ?_⟩⟩
  · linarith [le_max_right (u.val.y - η) (m.y - δ), le_max_right 0 (max (u.val.y - η) (m.y - δ))]
  · linarith [min_le_right (u.val.y + η) (m.y + δ), min_le_right 1 (min (u.val.y + η) (m.y + δ))]

theorem mid_mem_closure_basic_ord

TopologyByExample.ArensPlane.IsArensSet.mid_mem_closure_basic_ord

A point m of A on the line x = 1/2 lies in the closure of the basic neighbourhood of radius ε of an ordinary point p of A with 1/4 < x < 3/4, if their heights differ by less than ε: every horizontal strip around m crosses the square around p.

theorem mid_mem_closure_basic_ord (m : A) (hmx : m.val.x = 1 / 2) (hm0 : 0 < m.val.y)
    (hm1 : m.val.y < 1) {p : ArensPlane} (hp0 : 0 < p.y) (hpx : p.x ≠ 1 / 2)
    (hpx1 : 1 / 4 < p.x) (hpx2 : p.x < 3 / 4) {ε : ℝ} (hε : |m.val.y - p.y| < ε) :
    m ∈ closure (((↑) : A → ArensPlane) ⁻¹' basic p ε)
Proof
:= by
  rw [abs_lt] at hε
  refine (mem_closure_iff_nhds_basis' (hasBasis_nhds_sub m)).2 fun δ hδ ↦ ?_
  obtain ⟨v, h1, h2, h3, h4, hvx, hv0⟩ := hA.exists_pick
    (a := max (1 / 4) (p.x - ε)) (b := min (3 / 4) (p.x + ε))
    (c := max 0 (max (p.y - ε) (m.val.y - δ))) (d := min 1 (min (p.y + ε) (m.val.y + δ)))
    ((le_max_left _ _).trans' (by norm_num))
    (max_lt (lt_min (by norm_num) (by linarith)) (lt_min (by linarith) (by linarith)))
    ((min_le_left _ _).trans (by norm_num)) (le_max_left _ _)
    (max_lt (lt_min one_pos (lt_min (by linarith) (by linarith)))
      (max_lt (lt_min (by linarith) (lt_min (by linarith) (by linarith)))
        (lt_min (by linarith) (lt_min (by linarith) (by linarith)))))
    (min_le_left _ _)
  have hc1 := le_max_right (p.y - ε) (m.val.y - δ)
  have hc2 := le_max_left (p.y - ε) (m.val.y - δ)
  have hc := le_max_right 0 (max (p.y - ε) (m.val.y - δ))
  have hd1 := min_le_right (p.y + ε) (m.val.y + δ)
  have hd2 := min_le_left (p.y + ε) (m.val.y + δ)
  have hd := min_le_right 1 (min (p.y + ε) (m.val.y + δ))
  have ha1 := le_max_left (1 / 4 : ℝ) (p.x - ε)
  have ha2 := le_max_right (1 / 4 : ℝ) (p.x - ε)
  have hb1 := min_le_left (3 / 4 : ℝ) (p.x + ε)
  have hb2 := min_le_right (3 / 4 : ℝ) (p.x + ε)
  refine ⟨v, ?_, ?_⟩
  · change v.val ∈ basic m.val δ
    rw [basic_mid hm0.ne' hmx]
    exact ⟨by linarith, by linarith, hv0, abs_lt.2 ⟨by linarith, by linarith⟩⟩
  · change v.val ∈ basic p ε
    rw [basic_ord hp0.ne' hpx]
    exact ⟨abs_lt.2 ⟨by linarith, by linarith⟩, abs_lt.2 ⟨by linarith, by linarith⟩, hv0, hvx⟩

theorem eq_of_continuous_corners

TopologyByExample.ArensPlane.IsArensSet.eq_of_continuous_corners

Continuous real functions identify the two corners, if A has points on the lines x = 1/4 and x = 3/4 at heights dense in (0, 1), and points on the line x = 1/2 arbitrarily close to the axis. Write a and b for the values at the corners and ε for a fifth of |a - b|. A point m on the line x = 1/2, low enough, has a neighbourhood on which f is within ε of f m; a point u on the line x = 1/4 near the height of m lies in the closures of that neighbourhood and of a neighbourhood of the left corner on which f is within ε of a, so |a - f m| ≤ 2 ε; likewise |b - f m| ≤ 2 ε, which is impossible.

theorem eq_of_continuous_corners
    (h14 : ∀ c d : ℝ, 0 ≤ c → c < d → d ≤ 1 → ∃ u ∈ A, u.x = 1 / 4 ∧ c < u.y ∧ u.y < d)
    (h34 : ∀ c d : ℝ, 0 ≤ c → c < d → d ≤ 1 → ∃ u ∈ A, u.x = 3 / 4 ∧ c < u.y ∧ u.y < d)
    (hm : ∀ η : ℝ, 0 < η → ∃ m ∈ A, m.x = 1 / 2 ∧ 0 < m.y ∧ m.y < η)
    {f : A → ℝ} (hf : Continuous f) :
    f ⟨ArensPlane.mk 0 0, hA.left_mem⟩ = f ⟨ArensPlane.mk 1 0, hA.right_mem⟩
Proof
:= by
  set L : A := ⟨ArensPlane.mk 0 0, hA.left_mem⟩
  set R : A := ⟨ArensPlane.mk 1 0, hA.right_mem⟩
  by_contra hne
  set ε := |f L - f R| / 5
  have hε : 0 < ε := div_pos (abs_pos.2 (sub_ne_zero.2 hne)) (by norm_num)
  -- Neighbourhoods on which `f` is within `ε` of its value.
  have hnhds : ∀ z : A, ∃ δ > 0, ∀ q : A, q.val ∈ basic z.val δ → |f q - f z| < ε := by
    intro z
    obtain ⟨δ, hδ, h⟩ := (hasBasis_nhds_sub z).mem_iff.1
      (hf.continuousAt.preimage_mem_nhds (Metric.ball_mem_nhds (f z) hε))
    exact ⟨δ, hδ, fun q hq ↦ by simpa [Real.dist_eq] using h hq⟩
  -- A point of a closure of a set on which `f` is within `ε` of `c` has `f` within `ε` of `c`.
  have hcl : ∀ (S : Set A) (c : ℝ), (∀ q ∈ S, |f q - c| < ε) → ∀ q ∈ closure S,
      |f q - c| ≤ ε := fun S c h q hq ↦ closure_minimal (fun p hp ↦ (h p hp).le)
    (isClosed_le ((hf.sub continuous_const).abs) continuous_const) hq
  obtain ⟨δL, hδL, hL⟩ := hnhds L
  obtain ⟨δR, hδR, hR⟩ := hnhds R
  obtain ⟨m, hmA, hmx, hm0, hmδ⟩ := hm (min (min δL δR) 1)
    (lt_min (lt_min hδL hδR) one_pos)
  obtain ⟨δm, hδm, hM⟩ := hnhds ⟨m, hmA⟩
  -- The point on the line `x = 1/4`.
  obtain ⟨u, huA, hux, hu1, hu2⟩ := h14 (max 0 (m.y - δm)) (min (min δL 1) (m.y + δm))
    (le_max_left _ _) (max_lt (lt_min (lt_min hδL one_pos) (by linarith))
      (lt_min (lt_min (by linarith [min_le_left (min δL δR) 1, min_le_left δL δR])
        (by linarith [min_le_right (min δL δR) 1])) (by linarith)))
    ((min_le_left _ _).trans (min_le_right _ _))
  have hu0 : 0 < u.y := lt_of_le_of_lt (le_max_left _ _) hu1
  have hua : |f ⟨u, huA⟩ - f L| ≤ ε := hcl _ _ (fun q hq ↦ hL q hq) _
    (hA.mem_closure_basic_left ⟨u, huA⟩ hux hu0
      (hu2.trans_le ((min_le_left _ _).trans (min_le_left _ _))))
  have hum : |f ⟨u, huA⟩ - f ⟨m, hmA⟩| ≤ ε := hcl _ _ (fun q hq ↦ hM q hq) _
    (hA.mem_closure_basic_mid ⟨u, huA⟩ hu0 (by rw [hux]; norm_num) (by rw [hux])
      (by rw [hux]; norm_num) hm0.ne' hmx (abs_lt.2 ⟨by linarith [le_max_right 0 (m.y - δm)],
        by linarith [min_le_right (min δL 1) (m.y + δm)]⟩))
  -- The point on the line `x = 3/4`.
  obtain ⟨u', huA', hux', hu1', hu2'⟩ := h34 (max 0 (m.y - δm)) (min (min δR 1) (m.y + δm))
    (le_max_left _ _) (max_lt (lt_min (lt_min hδR one_pos) (by linarith))
      (lt_min (lt_min (by linarith [min_le_left (min δL δR) 1, min_le_right δL δR])
        (by linarith [min_le_right (min δL δR) 1])) (by linarith)))
    ((min_le_left _ _).trans (min_le_right _ _))
  have hu0' : 0 < u'.y := lt_of_le_of_lt (le_max_left _ _) hu1'
  have hub : |f ⟨u', huA'⟩ - f R| ≤ ε := hcl _ _ (fun q hq ↦ hR q hq) _
    (hA.mem_closure_basic_right ⟨u', huA'⟩ hux' hu0'
      (hu2'.trans_le ((min_le_left _ _).trans (min_le_left _ _))))
  have hum' : |f ⟨u', huA'⟩ - f ⟨m, hmA⟩| ≤ ε := hcl _ _ (fun q hq ↦ hM q hq) _
    (hA.mem_closure_basic_mid ⟨u', huA'⟩ hu0' (by rw [hux']; norm_num) (by rw [hux']; norm_num)
      (by rw [hux']) hm0.ne' hmx (abs_lt.2 ⟨by linarith [le_max_right 0 (m.y - δm)],
        by linarith [min_le_right (min δR 1) (m.y + δm)]⟩))
  have e1 := abs_sub_le (f L) (f ⟨u, huA⟩) (f ⟨m, hmA⟩)
  have e2 := abs_sub_le (f L) (f ⟨m, hmA⟩) (f ⟨u', huA'⟩)
  have e3 := abs_sub_le (f L) (f ⟨u', huA'⟩) (f R)
  have c1 : |f L - f ⟨u, huA⟩| = |f ⟨u, huA⟩ - f L| := abs_sub_comm _ _
  have c2 : |f ⟨m, hmA⟩ - f ⟨u', huA'⟩| = |f ⟨u', huA'⟩ - f ⟨m, hmA⟩| := abs_sub_comm _ _
  have key : |f L - f R| ≤ 4 * ε := by linarith
  have h5 : |f L - f R| = 5 * ε := by rw [show ε = |f L - f R| / 5 from rfl]; ring
  linarith

The Urysohn property

omit hA in

theorem t25Space_of_exists_closure

TopologyByExample.t25Space_of_exists_closure

A space is Urysohn if any two distinct points have neighbourhoods with disjoint closures.

theorem _root_.TopologyByExample.t25Space_of_exists_closure {X : Type*} [TopologicalSpace X]
    (h : ∀ ⦃a b : X⦄, a ≠ b → ∃ U ∈ 𝓝 a, ∃ V ∈ 𝓝 b, Disjoint (closure U) (closure V)) :
    T25Space X
Proof
:= by
  refine ⟨fun a b hab ↦ ?_⟩
  obtain ⟨U, hU, V, hV, hUV⟩ := h hab
  exact Filter.disjoint_iff.2 ⟨_, mem_lift' hU, _, mem_lift' hV, hUV⟩
omit hA in

theorem exists_closure_disjoint_of_y_ne

TopologyByExample.ArensPlane.IsArensSet.exists_closure_disjoint_of_y_ne

Points of A at different heights have neighbourhoods with disjoint closures.

theorem exists_closure_disjoint_of_y_ne {z w : A} (h : z.val.y ≠ w.val.y) :
    ∃ U ∈ 𝓝 z, ∃ V ∈ 𝓝 w, Disjoint (closure U) (closure V)
Proof
:= by
  set r := |z.val.y - w.val.y| / 3
  have hr : 0 < r := div_pos (abs_pos.2 (sub_ne_zero.2 h)) (by norm_num)
  refine ⟨{q | |q.val.y - z.val.y| < r}, (isOpen_lt ((continuous_y_sub.sub continuous_const).abs)
    continuous_const).mem_nhds (by simpa using hr), {q | |q.val.y - w.val.y| < r},
    (isOpen_lt ((continuous_y_sub.sub continuous_const).abs) continuous_const).mem_nhds
      (by simpa using hr), disjoint_left.2 fun q hq hq' ↦ ?_⟩
  have h1 := closure_subset_band (fun p (hp : |p.val.y - z.val.y| < r) ↦ hp.le) q hq
  have h2 := closure_subset_band (fun p (hp : |p.val.y - w.val.y| < r) ↦ hp.le) q hq'
  have := abs_sub_le z.val.y q.val.y w.val.y
  rw [abs_sub_comm z.val.y q.val.y] at this
  have : |z.val.y - w.val.y| = 3 * r := by ring
  linarith

theorem exists_closure_disjoint_corners

TopologyByExample.ArensPlane.IsArensSet.exists_closure_disjoint_corners

The two corners have neighbourhoods with disjoint closures: x ≤ 1/4 on the closure of a basic neighbourhood of the left corner and 3/4 ≤ x on that of the right one.

theorem exists_closure_disjoint_corners :
    ∃ U ∈ 𝓝 (⟨ArensPlane.mk 0 0, hA.left_mem⟩ : A), ∃ V ∈ 𝓝 (⟨ArensPlane.mk 1 0, hA.right_mem⟩ : A),
      Disjoint (closure U) (closure V)
Proof
:= by
  refine ⟨_, (hasBasis_nhds_sub _).mem_of_mem one_pos, _, (hasBasis_nhds_sub _).mem_of_mem one_pos,
    disjoint_left.2 fun q hq hq' ↦ ?_⟩
  have h1 := closure_minimal (fun p hp ↦ by
    change p.val ∈ basic (ArensPlane.mk 0 0) 1 at hp
    rw [basic_left (by simp) (by simp)] at hp
    rcases hp with hp | hp
    · change p.val.x ≤ 1 / 4; rw [hp]; norm_num
    · exact hp.1.le) hA.isClosed_x_le_quarter hq
  have h2 := closure_minimal (fun p hp ↦ by
    change p.val ∈ basic (ArensPlane.mk 1 0) 1 at hp
    rw [basic_right (by simp) (by simp; norm_num)] at hp
    rcases hp with hp | hp
    · change 3 / 4 ≤ p.val.x; rw [hp]; norm_num
    · exact hp.1.le) hA.isClosed_le_x_three_quarters hq'
  change q.val.x ≤ 1 / 4 at h1
  change 3 / 4 ≤ q.val.x at h2
  linarith

theorem t25Space

TopologyByExample.ArensPlane.IsArensSet.t25Space

The subspace is Urysohn if distinct points of A off the axis have different heights.

theorem t25Space (hy : ∀ z ∈ A, ∀ w ∈ A, z.y = w.y → z.y ≠ 0 → z = w) : T25Space A
Proof
:= by
  refine t25Space_of_exists_closure fun z w hzw ↦ ?_
  by_cases h : z.val.y = w.val.y
  · by_cases h0 : z.val.y = 0
    · have hz : z.val = ArensPlane.mk 0 0 ∨ z.val = ArensPlane.mk 1 0 := by
        rcases hA.mem z.val z.property with h' | h' | h'
        · exact .inl h'
        · exact .inr h'
        · linarith [h'.2.2.1]
      have hw : w.val = ArensPlane.mk 0 0 ∨ w.val = ArensPlane.mk 1 0 := by
        rcases hA.mem w.val w.property with h' | h' | h'
        · exact .inl h'
        · exact .inr h'
        · linarith [h'.2.2.1, h ▸ h0]
      obtain ⟨U, hU, V, hV, hUV⟩ := hA.exists_closure_disjoint_corners
      rcases hz with hz | hz <;> rcases hw with hw | hw
      · exact absurd (Subtype.ext (hz.trans hw.symm)) hzw
      · obtain rfl : z = ⟨_, hA.left_mem⟩ := Subtype.ext hz
        obtain rfl : w = ⟨_, hA.right_mem⟩ := Subtype.ext hw
        exact ⟨U, hU, V, hV, hUV⟩
      · obtain rfl : z = ⟨_, hA.right_mem⟩ := Subtype.ext hz
        obtain rfl : w = ⟨_, hA.left_mem⟩ := Subtype.ext hw
        exact ⟨V, hV, U, hU, hUV.symm⟩
      · exact absurd (Subtype.ext (hz.trans hw.symm)) hzw
    · exact absurd (Subtype.ext (hy z.val z.property w.val w.property h h0)) hzw
  · exact exists_closure_disjoint_of_y_ne h